[binutils-gdb] Fix: A potential bug of null pointer dereference
Nick Clifton
nickc@sourceware.org
Mon Oct 9 14:15:28 GMT 2023
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;
}
More information about the Binutils-cvs
mailing list