mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
Fix address violation when parsing a corrupt IEEE binary.
PR binutils/21633 * ieee.c (ieee_slurp_sections): Check for a NULL return from read_id. (ieee_archive_p): Likewise. (ieee_object_p): Likewise.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2017-06-21 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR binutils/21633
|
||||||
|
* ieee.c (ieee_slurp_sections): Check for a NULL return from
|
||||||
|
read_id.
|
||||||
|
(ieee_archive_p): Likewise.
|
||||||
|
(ieee_object_p): Likewise.
|
||||||
|
|
||||||
2017-06-21 Nick Clifton <nickc@redhat.com>
|
2017-06-21 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR binutils/21640
|
PR binutils/21640
|
||||||
|
@ -1246,6 +1246,8 @@ ieee_slurp_sections (bfd *abfd)
|
|||||||
|
|
||||||
/* Read section name, use it if non empty. */
|
/* Read section name, use it if non empty. */
|
||||||
name = read_id (&ieee->h);
|
name = read_id (&ieee->h);
|
||||||
|
if (name == NULL)
|
||||||
|
return FALSE;
|
||||||
if (name[0])
|
if (name[0])
|
||||||
section->name = name;
|
section->name = name;
|
||||||
|
|
||||||
@ -1395,6 +1397,8 @@ ieee_archive_p (bfd *abfd)
|
|||||||
(void) next_byte (&(ieee->h));
|
(void) next_byte (&(ieee->h));
|
||||||
|
|
||||||
library = read_id (&(ieee->h));
|
library = read_id (&(ieee->h));
|
||||||
|
if (library == NULL)
|
||||||
|
goto got_wrong_format_error;
|
||||||
if (strcmp (library, "LIBRARY") != 0)
|
if (strcmp (library, "LIBRARY") != 0)
|
||||||
goto got_wrong_format_error;
|
goto got_wrong_format_error;
|
||||||
|
|
||||||
@ -1922,9 +1926,13 @@ ieee_object_p (bfd *abfd)
|
|||||||
ieee->section_table_size = 0;
|
ieee->section_table_size = 0;
|
||||||
|
|
||||||
processor = ieee->mb.processor = read_id (&(ieee->h));
|
processor = ieee->mb.processor = read_id (&(ieee->h));
|
||||||
|
if (processor == NULL)
|
||||||
|
goto got_wrong_format;
|
||||||
if (strcmp (processor, "LIBRARY") == 0)
|
if (strcmp (processor, "LIBRARY") == 0)
|
||||||
goto got_wrong_format;
|
goto got_wrong_format;
|
||||||
ieee->mb.module_name = read_id (&(ieee->h));
|
ieee->mb.module_name = read_id (&(ieee->h));
|
||||||
|
if (ieee->mb.module_name == NULL)
|
||||||
|
goto got_wrong_format;
|
||||||
if (abfd->filename == (const char *) NULL)
|
if (abfd->filename == (const char *) NULL)
|
||||||
abfd->filename = xstrdup (ieee->mb.module_name);
|
abfd->filename = xstrdup (ieee->mb.module_name);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user