libiberty: Check zero value shstrndx in simple-object-elf.c
authorRen Kimura <rkx1209dev@gmail.com>
Tue, 23 Jul 2019 07:33:32 +0000 (07:33 +0000)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 23 Jul 2019 07:33:32 +0000 (07:33 +0000)
From-SVN: r273718

libiberty/ChangeLog
libiberty/simple-object-elf.c

index a0508e98b08660469c4fced3e3bee55b3ddfcc7a..ddd96183e010d0e4cc41530bd5c9f98df308cd34 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-12  Ren Kimura  <rkx1209dev@gmail.com>
+
+       * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx.
+       This fixes a Bug 90924.
+
 2019-07-22  Martin Liska  <mliska@suse.cz>
 
        * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
index 502388991a08e3e0bb5104f9981ee775a0e016b8..bdee963634d6846224558b01ddfe25526715e170 100644 (file)
@@ -548,7 +548,15 @@ simple_object_elf_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN],
       XDELETE (eor);
       return NULL;
     }
-
+  
+  if (eor->shstrndx == 0)
+    {
+      *errmsg = "invalid ELF shstrndx == 0";
+      *err = 0;
+      XDELETE (eor);
+      return NULL;
+    }
+  
   return (void *) eor;
 }