Skip to content

Commit d26a81e

Browse files
committed
gcc_register_root_tab expects a NULL-terminated list of ggc_root_tab
It appears that gcc_register_root_tab has always expected a NULL-terminated table of ggc_root_tab, and we were never NULL-terminating this, so it happened to only ever work by chance. Found when debugging segfaults seen on ARM in all of tests/plugin/gc (https://bugzilla.redhat.com/show_bug.cgi?id=864314); upon applying this patch, all of the tests/plugin/gc go from segfaulting to passing
1 parent 530347b commit d26a81e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gcc-python-wrapper.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,16 @@ my_walker(void *arg ATTRIBUTE_UNUSED)
316316
}
317317
}
318318

319-
static struct ggc_root_tab myroot = { (char*)"", 1, 1, my_walker, NULL };
319+
static struct ggc_root_tab myroottab[] = {
320+
{ (char*)"", 1, 1, my_walker, NULL },
321+
{ NULL, }
322+
};
320323

321324
void
322325
PyGcc_wrapper_init(void)
323326
{
324327
/* Register our GC root-walking callback: */
325-
ggc_register_root_tab(&myroot);
328+
ggc_register_root_tab(myroottab);
326329

327330
PyType_Ready(&PyGccWrapperMeta_TypeObj);
328331
}

0 commit comments

Comments
 (0)