mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
Prevent a memory exhaustion problem when trying to read in strings from a COFF binary with a corrupt string table size.
PR 22507 * coffgen.c (_bfd_coff_read_string_table): Check for an excessive size of the external string table.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-11-28 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 22507
|
||||||
|
* coffgen.c (_bfd_coff_read_string_table): Check for an excessive
|
||||||
|
size of the external string table.
|
||||||
|
|
||||||
2017-11-28 Nick Clifton <nickc@redhat.com>
|
2017-11-28 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 22506
|
PR 22506
|
||||||
|
@ -1718,7 +1718,7 @@ _bfd_coff_read_string_table (bfd *abfd)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strsize < STRING_SIZE_SIZE)
|
if (strsize < STRING_SIZE_SIZE || strsize > bfd_get_file_size (abfd))
|
||||||
{
|
{
|
||||||
_bfd_error_handler
|
_bfd_error_handler
|
||||||
/* xgettext: c-format */
|
/* xgettext: c-format */
|
||||||
@ -1726,7 +1726,7 @@ _bfd_coff_read_string_table (bfd *abfd)
|
|||||||
bfd_set_error (bfd_error_bad_value);
|
bfd_set_error (bfd_error_bad_value);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strings = (char *) bfd_malloc (strsize + 1);
|
strings = (char *) bfd_malloc (strsize + 1);
|
||||||
if (strings == NULL)
|
if (strings == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user