diff --git a/src/link/assign.cpp b/src/link/assign.cpp index 1e3c93bd..b7bd1b5c 100644 --- a/src/link/assign.cpp +++ b/src/link/assign.cpp @@ -270,6 +270,7 @@ static void placeSection(Section §ion) { assignSection(section, location); // Update the free space + assume(section.org + section.size <= UINT16_MAX); uint16_t sectionEnd = section.org + section.size; bool noLeftSpace = freeSpace.address == section.org; bool noRightSpace = freeSpace.address + freeSpace.size == sectionEnd; diff --git a/src/link/output.cpp b/src/link/output.cpp index 6e273367..8562d0bf 100644 --- a/src/link/output.cpp +++ b/src/link/output.cpp @@ -181,6 +181,7 @@ static void } // Output the section itself + assume(section->size == section->data.size()); fwrite(section->data.data(), 1, section->size, outputFile); offset += section->size; @@ -473,6 +474,7 @@ static void writeMapBank(SortedSections const §List, SectionType type, uint3 writeEmptySpace(prevEndAddr, sect.org); + assume(sect.org + sect.size <= UINT16_MAX); prevEndAddr = sect.org + sect.size; fprintf(mapFile, "\tSECTION: $%04" PRIx16, sect.org);