diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-26 17:54:00 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-10-19 10:28:33 -0600 |
commit | 22ad8107d35d833db000e5a5050c0f53af7af51f (patch) | |
tree | 62edd6544b2360ad1716819e441742ea329861c1 /gdb/symfile.c | |
parent | bacb77d0188ff37bacdbb211edd7e2419406b864 (diff) | |
download | gdb-22ad8107d35d833db000e5a5050c0f53af7af51f.zip gdb-22ad8107d35d833db000e5a5050c0f53af7af51f.tar.gz gdb-22ad8107d35d833db000e5a5050c0f53af7af51f.tar.bz2 |
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".
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 6a1140e..8ab6a25 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2497,6 +2497,7 @@ reread_symbols (void) objfile->psymtabs_addrmap = NULL; objfile->free_psymtabs = NULL; objfile->template_symbols = NULL; + objfile->static_links = NULL; /* obstack_init also initializes the obstack so it is empty. We could use obstack_specify_allocation but |