public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] asan: applying zero offset to NULL pointer
@ 2022-06-14  0:35 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-06-14  0:35 UTC (permalink / raw)
  To: bfd-cvs

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

commit 22b8da0ae7a9fa524b639623c66df63bd0beaf7c
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Jun 9 23:19:03 2022 +0930

    asan: applying zero offset to NULL pointer
    
            * dwarf.c (fetch_indexed_string): Move initialisation of "curr"
            and "end" after checking for missing section.

Diff:
---
 binutils/dwarf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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)


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

only message in thread, other threads:[~2022-06-14  0:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  0:35 [binutils-gdb] asan: applying zero offset to NULL pointer Alan Modra

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).