Clear static_links in reread_symbols
authorTom Tromey <tom@tromey.com>
Thu, 26 Jul 2018 23:54:00 +0000 (17:54 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 19 Oct 2018 16:28:33 +0000 (10:28 -0600)
commit22ad8107d35d833db000e5a5050c0f53af7af51f
tree62edd6544b2360ad1716819e441742ea329861c1
parentbacb77d0188ff37bacdbb211edd7e2419406b864
Clear static_links in reread_symbols

-fsanitize=address pointed out a use-after free in
objfile_register_static_link.  The bug turned out to be that
reread_symbols does not clear the static_links field; this leaves a
hash table that is filled with freed pointers.

Jan's (now quite old) idea of replacing reread_symbols with a simple
delete/new still seems good to me, and it's worth noting that it would
have avoided this bug.

Tested by the buildbot and by observing the change with
-fsanitize=address.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

* symfile.c (reread_symbols): Clear "static_links".
gdb/ChangeLog
gdb/symfile.c