aboutsummaryrefslogtreecommitdiff
path: root/bfd/compress.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-02-17 11:39:20 +0000
committerNick Clifton <nickc@redhat.com>2017-02-17 11:39:20 +0000
commit6438d1be9e9b6802a465c70c76b9cec7e23270f3 (patch)
tree57d80c28288951b635ad378facf05220671cf4fe /bfd/compress.c
parent51547df62c155231530ca502c485659f3d2b66cb (diff)
downloadgdb-6438d1be9e9b6802a465c70c76b9cec7e23270f3.zip
gdb-6438d1be9e9b6802a465c70c76b9cec7e23270f3.tar.gz
gdb-6438d1be9e9b6802a465c70c76b9cec7e23270f3.tar.bz2
Fix potential illegal memory access in ZLIB because of an erroneous declaration of the size of the input buffer.
* compress.c (bfd_get_full_section_contents): Remember to reduce compressed size by the sizeof the compression header when decompressing the contents.
Diffstat (limited to 'bfd/compress.c')
-rw-r--r--bfd/compress.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/compress.c b/bfd/compress.c
index 1ed7d74..f881c07 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -300,7 +300,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
SHF_COMPRESSED section. */
compression_header_size = 12;
if (!decompress_contents (compressed_buffer + compression_header_size,
- sec->compressed_size, p, sz))
+ sec->compressed_size - compression_header_size, p, sz))
{
bfd_set_error (bfd_error_bad_value);
if (p != *ptr)