mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Trap invalid section types in RGBDS objs
This commit is contained in:
@@ -354,7 +354,11 @@ static void readSection(
|
|||||||
tryGetc(
|
tryGetc(
|
||||||
uint8_t, byte, file, "%s: Cannot read \"%s\"'s type: %s", fileName, section.name.c_str()
|
uint8_t, byte, file, "%s: Cannot read \"%s\"'s type: %s", fileName, section.name.c_str()
|
||||||
);
|
);
|
||||||
section.type = (SectionType)(byte & 0x3F);
|
if (uint8_t type = byte & 0x3F; type >= SECTTYPE_INVALID) {
|
||||||
|
errx("\"%s\" has unknown section type 0x%02x", section.name.c_str(), type);
|
||||||
|
} else {
|
||||||
|
section.type = SectionType(type);
|
||||||
|
}
|
||||||
if (byte >> 7)
|
if (byte >> 7)
|
||||||
section.modifier = SECTION_UNION;
|
section.modifier = SECTION_UNION;
|
||||||
else if (byte >> 6)
|
else if (byte >> 6)
|
||||||
|
|||||||
Reference in New Issue
Block a user