asan: readelf: wild read in get_num_dynamic_syms
Alan Modra
amodra@gmail.com
Thu May 21 00:51:37 GMT 2020
* readelf.c (get_num_dynamic_syms): Bounds check mipsxlat array
access.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 87bb574129..798782c3a8 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
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list