Extend previous patch to cover uncompress_section_contents returning FALSE to other callers.

PR binutils/21135
	(dump_section_as_bytes, load_specific_debug_section): Likewise.
This commit is contained in:
Nick Clifton
2017-02-13 15:19:48 +00:00
parent f055032e4e
commit 1835f746a7
2 changed files with 28 additions and 11 deletions

View File

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

View File

@ -12691,10 +12691,18 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file)
new_size -= 12; new_size -= 12;
} }
if (uncompressed_size if (uncompressed_size)
&& uncompress_section_contents (& start, {
if (uncompress_section_contents (& start,
uncompressed_size, & new_size)) uncompressed_size, & new_size))
num_bytes = new_size; num_bytes = new_size;
else
{
error (_("Unable to decompress section %s\n"),
printable_section_name (section));
return;
}
}
} }
/* If the section being dumped has relocations against it the user might /* If the section being dumped has relocations against it the user might
@ -12986,8 +12994,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
size -= 12; size -= 12;
} }
if (uncompressed_size if (uncompressed_size)
&& uncompress_section_contents (&start, uncompressed_size, {
if (uncompress_section_contents (&start, uncompressed_size,
&size)) &size))
{ {
/* Free the compressed buffer, update the section buffer /* Free the compressed buffer, update the section buffer
@ -12995,6 +13004,13 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
free (section->start); free (section->start);
section->start = start; section->start = start;
} }
else
{
error (_("Unable to decompress section %s\n"),
printable_section_name (sec));
return 0;
}
}
section->size = size; section->size = size;
} }