diff options
author | Alan Modra <amodra@gmail.com> | 2020-04-20 11:01:47 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-04-20 11:09:58 +0930 |
commit | a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6 (patch) | |
tree | 2cf993358a3de2429a164bd3a037cb75f8cabcdb /binutils | |
parent | 8ff66993e0b57b20067d7a1b6c72a72f4cada2cf (diff) | |
download | gdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.zip gdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.tar.gz gdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.tar.bz2 |
readelf: segfault at readelf.c:12227
This is another one where not cleaning up sufficiently after
processing one file can lead to errors when processing the next file.
We have ngnuchains non-zero but gnuchains NULL in the following:
off < ngnuchains && (gnuchains[off] & 1) == 0
* readelf.c (process_symbol_table): Clear ngnuchains, ngnubuckets
and nbuckets.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/readelf.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 86eb578..6280eb7 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,10 @@ 2020-04-20 Alan Modra <amodra@gmail.com> + * readelf.c (process_symbol_table): Clear ngnuchains, ngnubuckets + and nbuckets. + +2020-04-20 Alan Modra <amodra@gmail.com> + * readelf.c (process_section_headers): Free dynamic symbols etc. earlier. diff --git a/binutils/readelf.c b/binutils/readelf.c index d9c9b7e..ea30f88 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12188,6 +12188,7 @@ process_symbol_table (Filedata * filedata) free (buckets); buckets = NULL; + nbuckets = 0; free (chains); chains = NULL; @@ -12263,8 +12264,10 @@ process_symbol_table (Filedata * filedata) } free (gnubuckets); gnubuckets = NULL; + ngnubuckets = 0; free (gnuchains); gnuchains = NULL; + ngnuchains = 0; free (mipsxlat); mipsxlat = NULL; return TRUE; @@ -12272,12 +12275,15 @@ process_symbol_table (Filedata * filedata) err_out: free (gnubuckets); gnubuckets = NULL; + ngnubuckets = 0; free (gnuchains); gnuchains = NULL; + ngnuchains = 0 free (mipsxlat); mipsxlat = NULL; free (buckets); buckets = NULL; + nbuckets = 0; free (chains); chains = NULL; return FALSE; |