Always initialise section->data to avoid an uninit read

The addition of SDCC objects required a change in the logic of
`mergeSections()` to dispatch based on `->data` instead of
`sect_HasData`, which implicitly assumes that `->data` is
always initialised (maybe NULL).
However, RGBDS sections did not do that!
This commit is contained in:
ISSOtm
2022-12-02 22:39:31 +01:00
parent ec2d1312ef
commit 75a07a90f8

View File

@@ -398,6 +398,8 @@ static void readSection(FILE *file, struct Section *section, char const *fileNam
for (uint32_t i = 0; i < section->nbPatches; i++)
readPatch(file, &patches[i], fileName, section->name, i, fileNodes);
section->patches = patches;
} else {
section->data = NULL; // `mergeSections()` expects to be able to always read the ptr
}
}