diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-14 10:25:51 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-14 12:19:28 +1030 |
commit | c8b3d02c49943d1fef2cc060dd7115a5ae5f7afe (patch) | |
tree | 33bef5e3c539eee314e2cd51fde0cca293d7ec95 /binutils | |
parent | 746598e07f7b666872bc31471de1b72de8a69c2b (diff) | |
download | gdb-c8b3d02c49943d1fef2cc060dd7115a5ae5f7afe.zip gdb-c8b3d02c49943d1fef2cc060dd7115a5ae5f7afe.tar.gz gdb-c8b3d02c49943d1fef2cc060dd7115a5ae5f7afe.tar.bz2 |
objdump segfault after symbol table error
This memcpy segfaults if symcount is -1 (=> syms is NULL).
memcpy (sorted_syms, symcount ? syms : dynsyms,
sorted_symcount * sizeof (asymbol *));
* objdump.c (slurp_symtab): Don't leave symcount as -1 after
an error.
(slurp_dynamic_symtab): Likewise for dynsymcount.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/objdump.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index 0e8e198..5dac13b 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1015,6 +1015,7 @@ slurp_symtab (bfd *abfd) my_bfd_nonfatal (bfd_get_filename (abfd)); free (sy); sy = NULL; + symcount = 0; } return sy; } @@ -1048,6 +1049,7 @@ slurp_dynamic_symtab (bfd *abfd) my_bfd_nonfatal (bfd_get_filename (abfd)); free (sy); sy = NULL; + dynsymcount = 0; } return sy; } |