public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix: A potential bug of null pointer dereference
@ 2023-10-09 14:15 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-10-09 14:15 UTC (permalink / raw)
  To: bfd-cvs

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

commit e7c3fa04b6c54aae88675a7dcd9c76b322ec2171
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Oct 9 15:14:52 2023 +0100

    Fix: A potential bug of null pointer dereference
    
      PR 30949
      * elflink.c (elf_gc_mark_debug_section): Check for bfd_section_from_elf_index returning a NULL pointer.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/elflink.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bf70a1da22d..da287723935 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ca162145f7e..99f4cdd5527 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-09 14:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 14:15 [binutils-gdb] Fix: A potential bug of null pointer dereference Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).