From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: asan: applying zero offset to NULL pointer
Date: Tue, 14 Jun 2022 09:53:35 +0930 [thread overview]
Message-ID: <YqfVB8dJqRLzkyw7@squeak.grove.modra.org> (raw)
* dwarf.c (fetch_indexed_string): Move initialisation of "curr"
and "end" after checking for missing section.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index caa3ce48d00..c16f5a891b7 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -700,8 +700,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
dwarf_vma index_offset;
dwarf_vma str_offset;
const char * ret;
- unsigned char *curr = index_section->start;
- unsigned char *end = curr + index_section->size;
+ unsigned char *curr, *end;
dwarf_vma length;
if (index_section->start == NULL)
@@ -712,6 +711,8 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
return (dwo ? _("<no .debug_str.dwo section>")
: _("<no .debug_str section>"));
+ curr = index_section->start;
+ end = curr + index_section->size;
/* FIXME: We should cache the length... */
SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
if (length == 0xffffffff)
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2022-06-14 0:23 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=YqfVB8dJqRLzkyw7@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@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).