mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 09:49:43 +08:00
Fix seg-fault attempting to compress a debug section in a corrupt binary.
PR binutils/21431 * compress.c (bfd_init_section_compress_status): Check the return value from bfd_malloc.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-04-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR binutils/21431
|
||||||
|
* compress.c (bfd_init_section_compress_status): Check the return
|
||||||
|
value from bfd_malloc.
|
||||||
|
|
||||||
2017-04-24 H.J. Lu <hongjiu.lu@intel.com>
|
2017-04-24 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
|
* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
|
||||||
|
@ -542,7 +542,6 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
|
|||||||
{
|
{
|
||||||
bfd_size_type uncompressed_size;
|
bfd_size_type uncompressed_size;
|
||||||
bfd_byte *uncompressed_buffer;
|
bfd_byte *uncompressed_buffer;
|
||||||
bfd_boolean ret;
|
|
||||||
|
|
||||||
/* Error if not opened for read. */
|
/* Error if not opened for read. */
|
||||||
if (abfd->direction != read_direction
|
if (abfd->direction != read_direction
|
||||||
@ -558,18 +557,18 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
|
|||||||
/* Read in the full section contents and compress it. */
|
/* Read in the full section contents and compress it. */
|
||||||
uncompressed_size = sec->size;
|
uncompressed_size = sec->size;
|
||||||
uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
|
uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
|
||||||
|
/* PR 21431 */
|
||||||
|
if (uncompressed_buffer == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!bfd_get_section_contents (abfd, sec, uncompressed_buffer,
|
if (!bfd_get_section_contents (abfd, sec, uncompressed_buffer,
|
||||||
0, uncompressed_size))
|
0, uncompressed_size))
|
||||||
ret = FALSE;
|
return FALSE;
|
||||||
else
|
|
||||||
{
|
|
||||||
uncompressed_size = bfd_compress_section_contents (abfd, sec,
|
|
||||||
uncompressed_buffer,
|
|
||||||
uncompressed_size);
|
|
||||||
ret = uncompressed_size != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
uncompressed_size = bfd_compress_section_contents (abfd, sec,
|
||||||
|
uncompressed_buffer,
|
||||||
|
uncompressed_size);
|
||||||
|
return uncompressed_size != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user