forked from Imagelibrary/binutils-gdb
Re: readelf..debug-dump=loc displays bogus base addresses
Commitb05efa39b4removed checks I added in commitf22f27f46cto prevent segfaults when debug_info_p is NULL, which can be the case with fuzzed objects. Restore those checks. Also, for dwo look at rnglists_dwo rather than rnglists.
This commit is contained in:
@@ -2771,7 +2771,9 @@ read_and_display_attr_value (unsigned long attribute,
|
|||||||
|
|
||||||
if (form == DW_FORM_loclistx)
|
if (form == DW_FORM_loclistx)
|
||||||
{
|
{
|
||||||
if (dwo)
|
if (debug_info_p == NULL)
|
||||||
|
idx = -1;
|
||||||
|
else if (dwo)
|
||||||
{
|
{
|
||||||
idx = fetch_indexed_offset (uvalue, loclists_dwo,
|
idx = fetch_indexed_offset (uvalue, loclists_dwo,
|
||||||
debug_info_p->loclists_base,
|
debug_info_p->loclists_base,
|
||||||
@@ -2779,7 +2781,7 @@ read_and_display_attr_value (unsigned long attribute,
|
|||||||
if (idx != (uint64_t) -1)
|
if (idx != (uint64_t) -1)
|
||||||
idx += (offset_size == 8) ? 20 : 12;
|
idx += (offset_size == 8) ? 20 : 12;
|
||||||
}
|
}
|
||||||
else if (debug_info_p == NULL || dwarf_version > 4)
|
else if (dwarf_version > 4)
|
||||||
{
|
{
|
||||||
idx = fetch_indexed_offset (uvalue, loclists,
|
idx = fetch_indexed_offset (uvalue, loclists,
|
||||||
debug_info_p->loclists_base,
|
debug_info_p->loclists_base,
|
||||||
@@ -2804,22 +2806,14 @@ read_and_display_attr_value (unsigned long attribute,
|
|||||||
}
|
}
|
||||||
else if (form == DW_FORM_rnglistx)
|
else if (form == DW_FORM_rnglistx)
|
||||||
{
|
{
|
||||||
if (dwo)
|
if (debug_info_p == NULL)
|
||||||
{
|
idx = -1;
|
||||||
idx = fetch_indexed_offset (uvalue, rnglists,
|
else
|
||||||
|
idx = fetch_indexed_offset (uvalue,
|
||||||
|
dwo ? rnglists_dwo : rnglists,
|
||||||
debug_info_p->rnglists_base,
|
debug_info_p->rnglists_base,
|
||||||
debug_info_p->offset_size);
|
debug_info_p->offset_size);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (debug_info_p == NULL)
|
|
||||||
base = 0;
|
|
||||||
else
|
|
||||||
base = debug_info_p->rnglists_base;
|
|
||||||
idx = fetch_indexed_offset (uvalue, rnglists, base,
|
|
||||||
debug_info_p->offset_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug_info_p == NULL)
|
if (debug_info_p == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user