diff options
author | Nick Clifton <nickc@redhat.com> | 2017-02-13 15:19:48 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-02-13 15:19:48 +0000 |
commit | 1835f746a7c7fff70a2cc03a051b14fdc6b3f73f (patch) | |
tree | 2ae74a700bbbeff439eb38d9b31507d5399bc48f /binutils | |
parent | f055032e4e922f1e1a5e11026c7c2669fa2a7d19 (diff) | |
download | gdb-1835f746a7c7fff70a2cc03a051b14fdc6b3f73f.zip gdb-1835f746a7c7fff70a2cc03a051b14fdc6b3f73f.tar.gz gdb-1835f746a7c7fff70a2cc03a051b14fdc6b3f73f.tar.bz2 |
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.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 1 | ||||
-rw-r--r-- | binutils/readelf.c | 38 |
2 files changed, 28 insertions, 11 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index fdd5f33..294e66c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -3,6 +3,7 @@ PR binutils/21135 * readelf.c (dump_section_as_bytes): Handle the case where uncompress_section_contents returns false. + (dump_section_as_bytes, load_specific_debug_section): Likewise. 2017-02-13 Nick Clifton <nickc@redhat.com> diff --git a/binutils/readelf.c b/binutils/readelf.c index ede5747..c73a327 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12691,10 +12691,18 @@ dump_section_as_strings (Elf_Internal_Shdr * section, FILE * file) new_size -= 12; } - if (uncompressed_size - && uncompress_section_contents (& start, - uncompressed_size, & new_size)) - num_bytes = new_size; + if (uncompressed_size) + { + if (uncompress_section_contents (& start, + uncompressed_size, & 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 @@ -12986,14 +12994,22 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, size -= 12; } - if (uncompressed_size - && uncompress_section_contents (&start, uncompressed_size, - &size)) + if (uncompressed_size) { - /* Free the compressed buffer, update the section buffer - and the section size if uncompress is successful. */ - free (section->start); - section->start = start; + if (uncompress_section_contents (&start, uncompressed_size, + &size)) + { + /* Free the compressed buffer, update the section buffer + and the section size if uncompress is successful. */ + free (section->start); + section->start = start; + } + else + { + error (_("Unable to decompress section %s\n"), + printable_section_name (sec)); + return 0; + } } section->size = size; } |