]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix: A potential bug of null pointer dereference
authorNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 14:14:52 +0000 (15:14 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 14:14:52 +0000 (15:14 +0100)
  PR 30949
  * elflink.c (elf_gc_mark_debug_section): Check for bfd_section_from_elf_index returning a NULL pointer.

bfd/ChangeLog
bfd/elflink.c

index bf70a1da22d08ff3dee7553652e0f61ecf4fab10..da287723935af9c69581cc61c70cb146ca361b91 100644 (file)
@@ -1,3 +1,9 @@
+2023-10-09  Nick Clifton  <nickc@redhat.com>
+
+       PR 30949
+       * elflink.c (elf_gc_mark_debug_section): Check for
+       bfd_section_from_elf_index returning a NULL pointer.
+
 2023-10-06  Nick Clifton  <nickc@redhat.com>
 
        PR 30940
index ca162145f7ec854adc34ef1b60693fbbf6330ad3..99f4cdd5527139f3af9f75e5e932b05fd0986046 100644 (file)
@@ -13710,7 +13710,7 @@ elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
       /* Return the local debug definition section.  */
       asection *isec = bfd_section_from_elf_index (sec->owner,
                                                   sym->st_shndx);
-      if ((isec->flags & SEC_DEBUGGING) != 0)
+      if (isec != NULL && (isec->flags & SEC_DEBUGGING) != 0)
        return isec;
     }