Fix invalid read of section contents whilst processing a corrupt binary.

PR binutils/21135
	* readelf.c (dump_section_as_bytes): Handle the case where
	uncompress_section_contents returns false.
This commit is contained in:
Nick Clifton
2017-02-13 15:04:37 +00:00
parent ebdf1ebfa5
commit f055032e4e
2 changed files with 18 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2017-02-13 Nick Clifton <nickc@redhat.com>
PR binutils/21135
* readelf.c (dump_section_as_bytes): Handle the case where
uncompress_section_contents returns false.
2017-02-13 Nick Clifton <nickc@redhat.com>
PR binutils/21149

View File

@ -12825,10 +12825,18 @@ dump_section_as_bytes (Elf_Internal_Shdr * section,
new_size -= 12;
}
if (uncompressed_size
&& uncompress_section_contents (& start, uncompressed_size,
if (uncompressed_size)
{
if (uncompress_section_contents (& start, uncompressed_size,
& new_size))
section_size = new_size;
else
{
error (_("Unable to decompress section %s\n"),
printable_section_name (section));
return;
}
}
}
if (relocate)