From: Alan Modra <amodra@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] Re: Fix null pointer dereference in process_debug_info()
Date: Thu, 11 Apr 2024 23:41:35 +0000 (GMT) [thread overview]
Message-ID: <20240411234135.4CB273858D33@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f8adbf77dd3f40e74529fa989dca034c73a7273
commit 0f8adbf77dd3f40e74529fa989dca034c73a7273
Author: Alan Modra <amodra@gmail.com>
Date: Fri Apr 12 08:55:02 2024 +0930
Re: Fix null pointer dereference in process_debug_info()
read_bases has a potential null-pointer deref too, and without a
debug_info_p there isn't any point in calling read_bases.
* dwarf.c (process_debug_info): Don't call read_bases when
debug_info_p is NULL.
Diff:
---
binutils/dwarf.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index ce508d0315f..3ce79f4e5d1 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -4236,7 +4236,7 @@ process_debug_info (struct dwarf_section * section,
Only needed for the top DIE on DWARFv5+.
No simiar treatment for loclists_base because there should
be no loclist attributes in top DIE. */
- if (compunit.cu_version >= 5 && level == 0)
+ if (debug_info_p && compunit.cu_version >= 5 && level == 0)
{
int64_t stemp;
@@ -4248,17 +4248,14 @@ process_debug_info (struct dwarf_section * section,
compunit.cu_version,
debug_info_p);
- if (debug_info_p)
+ /* This check was in place before, keep it. */
+ stemp = debug_info_p->rnglists_base;
+ if (stemp < 0)
{
- /* This check was in place before, keep it. */
- stemp = debug_info_p->rnglists_base;
- if (stemp < 0)
- {
- warn (_("CU @ %#" PRIx64 " has has a negative rnglists_base "
- "value of %#" PRIx64 " - treating as zero"),
- debug_info_p->cu_offset, stemp);
- debug_info_p->rnglists_base = 0;
- }
+ warn (_("CU @ %#" PRIx64 " has has a negative rnglists_base "
+ "value of %#" PRIx64 " - treating as zero"),
+ debug_info_p->cu_offset, stemp);
+ debug_info_p->rnglists_base = 0;
}
}
reply other threads:[~2024-04-11 23:41 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=20240411234135.4CB273858D33@sourceware.org \
--to=amodra@sourceware.org \
--cc=binutils-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).