Fix free of unallocated memory in the BFD library's compression code.

PR 31455
This commit is contained in:
Nick Clifton
2024-03-19 12:48:04 +00:00
parent dcca32c28b
commit 2c16eb1d83

View File

@@ -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)