ref: 75a07a90f842382d7f888def0eb0104391620099
parent: ec2d1312ef39a18e9e8fe155bf91d58c79b5878b
author: ISSOtm <eldredhabert0@gmail.com>
date: Fri Dec 2 17:39:31 EST 2022
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!
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -398,6 +398,8 @@
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
}
}