From: Nick Clifton <nickc@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Fix: A potential bug of null pointer dereference
Date: Mon, 9 Oct 2023 14:15:28 +0000 (GMT) [thread overview]
Message-ID: <20231009141528.EB1B13858D1E@sourceware.org> (raw)
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;
}
reply other threads:[~2023-10-09 14:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231009141528.EB1B13858D1E@sourceware.org \
--to=nickc@sourceware.org \
--cc=bfd-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).