mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
asan: applying zero offset to NULL pointer
* dwarf.c (fetch_indexed_string): Move initialisation of "curr" and "end" after checking for missing section.
This commit is contained in:
@ -700,8 +700,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
|
|||||||
dwarf_vma index_offset;
|
dwarf_vma index_offset;
|
||||||
dwarf_vma str_offset;
|
dwarf_vma str_offset;
|
||||||
const char * ret;
|
const char * ret;
|
||||||
unsigned char *curr = index_section->start;
|
unsigned char *curr, *end;
|
||||||
unsigned char *end = curr + index_section->size;
|
|
||||||
dwarf_vma length;
|
dwarf_vma length;
|
||||||
|
|
||||||
if (index_section->start == NULL)
|
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>")
|
return (dwo ? _("<no .debug_str.dwo section>")
|
||||||
: _("<no .debug_str section>"));
|
: _("<no .debug_str section>"));
|
||||||
|
|
||||||
|
curr = index_section->start;
|
||||||
|
end = curr + index_section->size;
|
||||||
/* FIXME: We should cache the length... */
|
/* FIXME: We should cache the length... */
|
||||||
SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
|
SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
|
||||||
if (length == 0xffffffff)
|
if (length == 0xffffffff)
|
||||||
|
Reference in New Issue
Block a user