Reject debuglink sections with no associated filename.
authorNick Clifton <nickc@redhat.com>
Tue, 27 Apr 2021 14:19:41 +0000 (15:19 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 27 Apr 2021 14:19:41 +0000 (15:19 +0100)
PR 27779
* dwarf.c (parse_gnu_debuglink): Reject empty names.
(parse_gnu_debugaltlink): Likewise.

binutils/ChangeLog
binutils/dwarf.c

index 9a1fd5dae09696a84d84e294af8757983ec5776a..a2603133dc4811ae262c1e6699425a858edcbc74 100644 (file)
@@ -1,3 +1,9 @@
+2021-04-27  Nick Clifton  <nickc@redhat.com>
+
+       PR 27779
+       * dwarf.c (parse_gnu_debuglink): Reject empty names.
+       (parse_gnu_debugaltlink): Likewise.
+
 2021-04-22  ClĂ©ment Chigot  <clement.chigot@atos.net>
 
        * od-xcoff.c (dump_xcoff32_symbols): Adapt to new
index 562dce5dd2631d90a46e016b246111345e093bad..e1f76102056680b5518838dd837775585b2da1b0 100644 (file)
@@ -10957,6 +10957,8 @@ parse_gnu_debuglink (struct dwarf_section * section, void * data)
   name = (const char *) section->start;
 
   crc_offset = strnlen (name, section->size) + 1;
+  if (crc_offset == 1)
+    return NULL;
   crc_offset = (crc_offset + 3) & ~3;
   if (crc_offset + 4 > section->size)
     return NULL;
@@ -10998,6 +11000,8 @@ parse_gnu_debugaltlink (struct dwarf_section * section, void * data)
 
   name = (const char *) section->start;
   namelen = strnlen (name, section->size) + 1;
+  if (namelen == 1)
+    return NULL;
   if (namelen >= section->size)
     return NULL;
 
This page took 0.029382 seconds and 4 git commands to generate.