Skip to content

Commit

Permalink
gcc_register_root_tab expects a NULL-terminated list of ggc_root_tab
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidmalcolm committed Apr 29, 2013
1 parent 530347b commit d26a81e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gcc-python-wrapper.c
Expand Up @@ -316,13 +316,16 @@ my_walker(void *arg ATTRIBUTE_UNUSED)
}
}

static struct ggc_root_tab myroot = { (char*)"", 1, 1, my_walker, NULL };
static struct ggc_root_tab myroottab[] = {
{ (char*)"", 1, 1, my_walker, NULL },
{ NULL, }
};

void
PyGcc_wrapper_init(void)
{
/* Register our GC root-walking callback: */
ggc_register_root_tab(&myroot);
ggc_register_root_tab(myroottab);

PyType_Ready(&PyGccWrapperMeta_TypeObj);
}
Expand Down

0 comments on commit d26a81e

Please sign in to comment.