asan: readelf: wild read in get_num_dynamic_syms

* readelf.c (get_num_dynamic_syms): Bounds check mipsxlat array
	access.
This commit is contained in:
Alan Modra 2020-05-21 09:48:35 +09:30
parent 1484644d35
commit c31ab5a001
2 changed files with 7 additions and 1 deletions

View File

@ -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.

View File

@ -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