X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Fsegments.c;h=0ae19b6d6398e8db36dd3ca5bf96f884cbf96656;hb=3e887bd9dd06b89177bff864b50fc58c8dadc8bf;hp=3946fbad6b27c02c3b10ea5b10aee9af42cfbed3;hpb=bfbedfa54b98d059c62f82609a0966f4acddd174;p=cc65 diff --git a/src/ld65/segments.c b/src/ld65/segments.c index 3946fbad6..0ae19b6d6 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -312,7 +312,13 @@ Section* ReadSection (FILE* F, ObjData* O) LineInfoIndex = ReadVar (F); if (LineInfoIndex) { --LineInfoIndex; - CHECK (LineInfoIndex < O->LineInfoCount); + if (LineInfoIndex >= O->LineInfoCount) { + Internal ("In module `%s', file `%s', line %lu: Invalid line " + "info with index %u (max count %u)", + GetObjFileName (O), + GetSourceFileName (O, Frag->Pos.Name), + Frag->Pos.Line, LineInfoIndex, O->LineInfoCount); + } /* Point from the fragment to the line info... */ Frag->LI = O->LineInfos[LineInfoIndex]; /* ...and back from the line info to the fragment */ @@ -495,6 +501,7 @@ void SegWrite (FILE* Tgt, Segment* S, SegWriteFunc F, void* Data) /* If we have fill bytes, write them now */ WriteMult (Tgt, S->FillVal, Sec->Fill); + Offs += Sec->Fill; /* Loop over all fragments in this section */ Frag = Sec->FragRoot;