aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-04-15 16:38:01 +0930
committerAlan Modra <amodra@gmail.com>2020-04-15 17:03:22 +0930
commit001890e1f9269697f7e0212430a51479271bdab2 (patch)
tree1b511a57cd6257fb859dca98c3761094e75d2b36 /binutils/readelf.c
parentb71d4fa7c35c1918e96bc3c297f940b5c1624e21 (diff)
downloadgdb-001890e1f9269697f7e0212430a51479271bdab2.zip
gdb-001890e1f9269697f7e0212430a51479271bdab2.tar.gz
gdb-001890e1f9269697f7e0212430a51479271bdab2.tar.bz2
PR25822, Invalid read in process_symbol_table
PR 25822 * readelf.c (get_num_dynamic_syms): Don't set num_of_syms when reading buckets or chains fails.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 80af9a2..0ea8273 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9969,11 +9969,13 @@ get_num_dynamic_syms (Filedata * filedata)
nbuckets = byte_get (nb, hash_ent_size);
nchains = byte_get (nc, hash_ent_size);
- num_of_syms = nchains;
buckets = get_dynamic_data (filedata, nbuckets, hash_ent_size);
chains = get_dynamic_data (filedata, nchains, hash_ent_size);
+ if (buckets != NULL && chains != NULL)
+ num_of_syms = nchains;
+
no_hash:
if (num_of_syms == 0)
{