diff options
author | Nick Clifton <nickc@redhat.com> | 2024-03-19 12:48:04 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2024-03-19 12:48:04 +0000 |
commit | 2c16eb1d8346f0d390f5278d5ff187854c2d5879 (patch) | |
tree | 7f1cde01e7d732a67b50eb3fe5dde5484930d73a /bfd/compress.c | |
parent | dcca32c28b4478ea66e484abf9cdd2b9c4aac2fa (diff) | |
download | binutils-2c16eb1d8346f0d390f5278d5ff187854c2d5879.zip binutils-2c16eb1d8346f0d390f5278d5ff187854c2d5879.tar.gz binutils-2c16eb1d8346f0d390f5278d5ff187854c2d5879.tar.bz2 |
Fix free of unallocated memory in the BFD library's compression code.
PR 31455
Diffstat (limited to 'bfd/compress.c')
-rw-r--r-- | bfd/compress.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/compress.c b/bfd/compress.c index 8bc44de..38eb182 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -585,6 +585,10 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec) if (compressed && orig_header_size < 0) abort (); + /* PR 31455: Check for a corrupt uncompressed size. */ + if (uncompressed_size == (bfd_size_type) -1) + return uncompressed_size; + /* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size, overhead in .zdebug* section. */ if (!new_header_size) |