aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-05-21 09:48:35 +0930
committerAlan Modra <amodra@gmail.com>2020-05-21 10:11:57 +0930
commitc31ab5a0010ac9e3d31fd218fffcff1b9696363e (patch)
treeaf9bd31b04d1446486b80be3f3a8cafb2f37e1c1 /binutils
parent1484644d3597a98be824220ca290de84408eeb3f (diff)
downloadgdb-c31ab5a0010ac9e3d31fd218fffcff1b9696363e.zip
gdb-c31ab5a0010ac9e3d31fd218fffcff1b9696363e.tar.gz
gdb-c31ab5a0010ac9e3d31fd218fffcff1b9696363e.tar.bz2
asan: readelf: wild read in get_num_dynamic_syms
* readelf.c (get_num_dynamic_syms): Bounds check mipsxlat array access.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2b90351..e906bdf 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-21 Alan Modra <amodra@gmail.com>
+
+ * readelf.c (get_num_dynamic_syms): Bounds check mipsxlat array
+ access.
+
2020-05-20 Nelson Chu <nelson.chu@sifive.com>
* dwarf.c: Updated since DECLARE_CSR is changed.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 87bb574..798782c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10211,7 +10211,8 @@ get_num_dynamic_syms (Filedata * filedata)
{
if (filedata->dynamic_info_DT_MIPS_XHASH)
{
- if (filedata->mipsxlat[off] >= num_of_syms)
+ if (off < filedata->ngnuchains
+ && filedata->mipsxlat[off] >= num_of_syms)
num_of_syms = filedata->mipsxlat[off] + 1;
}
else