Fix an invalid memory access triggered by running readelf on a fuzzed binary.
PR binutils/17531 * readelf.c (process_mips_specific): Fail if an option has an invalid size.
This commit is contained in:
parent
9e2dec4710
commit
5532504724
@ -8,6 +8,8 @@
|
|||||||
* dwarf.c (xcmalloc): Fail if the arguments are too big.
|
* dwarf.c (xcmalloc): Fail if the arguments are too big.
|
||||||
(xcrealloc): Likewise.
|
(xcrealloc): Likewise.
|
||||||
(xcalloc2): Likewise.
|
(xcalloc2): Likewise.
|
||||||
|
* readelf.c (process_mips_specific): Fail if an option has an
|
||||||
|
invalid size.
|
||||||
|
|
||||||
2015-02-05 Alan Modra <amodra@gmail.com>
|
2015-02-05 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
@ -13880,9 +13880,8 @@ process_mips_specific (FILE * file)
|
|||||||
if (option->size < sizeof (* eopt)
|
if (option->size < sizeof (* eopt)
|
||||||
|| offset + option->size > sect->sh_size)
|
|| offset + option->size > sect->sh_size)
|
||||||
{
|
{
|
||||||
warn (_("Invalid size (%u) for MIPS option\n"), option->size);
|
error (_("Invalid size (%u) for MIPS option\n"), option->size);
|
||||||
option->size = sizeof (* eopt);
|
return 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
offset += option->size;
|
offset += option->size;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user