Fix address violation when parsing a corrupt IEEE binary.
authorNick Clifton <nickc@redhat.com>
Wed, 21 Jun 2017 09:54:04 +0000 (10:54 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 21 Jun 2017 09:54:04 +0000 (10:54 +0100)
PR binutils/21633
* ieee.c (ieee_slurp_sections): Check for a NULL return from
read_id.
(ieee_archive_p): Likewise.
(ieee_object_p): Likewise.

bfd/ChangeLog
bfd/ieee.c

index 9bc63e1d6c5c02b06c13437a057e31321e5449e0..9e1cb05272eb872354384bec6419fac5e9efc542 100644 (file)
@@ -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>
 
        PR binutils/21640
index 08d08d4eecbe1c27ab982bd37f92f07693136fa9..958a40be0c49b7e4b923809e6c60342100bc6cfa 100644 (file)
@@ -1246,6 +1246,8 @@ ieee_slurp_sections (bfd *abfd)
 
                /* Read section name, use it if non empty.  */
                name = read_id (&ieee->h);
+               if (name == NULL)
+                 return FALSE;
                if (name[0])
                  section->name = name;
 
@@ -1395,6 +1397,8 @@ ieee_archive_p (bfd *abfd)
   (void) next_byte (&(ieee->h));
 
   library = read_id (&(ieee->h));
+  if (library == NULL)
+    goto got_wrong_format_error;    
   if (strcmp (library, "LIBRARY") != 0)
     goto got_wrong_format_error;
 
@@ -1922,9 +1926,13 @@ ieee_object_p (bfd *abfd)
   ieee->section_table_size = 0;
 
   processor = ieee->mb.processor = read_id (&(ieee->h));
+  if (processor == NULL)
+    goto got_wrong_format;    
   if (strcmp (processor, "LIBRARY") == 0)
     goto got_wrong_format;
   ieee->mb.module_name = read_id (&(ieee->h));
+  if (ieee->mb.module_name == NULL)
+    goto got_wrong_format;
   if (abfd->filename == (const char *) NULL)
     abfd->filename = xstrdup (ieee->mb.module_name);
 
This page took 0.02831 seconds and 4 git commands to generate.