[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils-cvs
Subject:    [binutils-gdb] Reject debuglink sections with no associated filename.
From:       Nick Clifton via Binutils-cvs <binutils-cvs () sourceware ! org>
Date:       2021-04-27 14:20:09
Message-ID: 20210427142009.DACD33894C11 () sourceware ! org
[Download RAW message or body]

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3d64c987c7ca9451bae7dd23ce147ce460caeb20

commit 3d64c987c7ca9451bae7dd23ce147ce460caeb20
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Apr 27 15:19:41 2021 +0100

    Reject debuglink sections with no associated filename.
    
            PR 27779
            * dwarf.c (parse_gnu_debuglink): Reject empty names.
            (parse_gnu_debugaltlink): Likewise.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/dwarf.c   | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9a1fd5dae09..a2603133dc4 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 562dce5dd26..e1f76102056 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic