From: Nick Clifton Date: Mon, 27 Jun 2022 12:30:35 +0000 (+0100) Subject: Fix NULL pointer indirection when parsing corrupt DWARF data. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e98e7d9a70dcc987bff0e925f20b78cd4a2979ed;p=binutils-gdb.git Fix NULL pointer indirection when parsing corrupt DWARF data. PR 29290 * dwarf.c (read_and_display_attr_value): Check that debug_info_p is set before dereferencing it. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 48a3750c52d..7c547e67eab 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,7 +1,14 @@ +2022-06-27 Nick Clifton + + PR 29290 + * dwarf.c (read_and_display_attr_value): Check that debug_info_p + is set before dereferencing it. + 2022-06-27 Nick Clifton * dwarf.c (fetch_indexed_string): Do not use length of first table in string section as the length of every table in the section. + * testsuite/binutils-all/pr26112.r: Update expected output. 2022-06-22 Kumar N, Bhuvanendra diff --git a/binutils/dwarf.c b/binutils/dwarf.c index bcabb61b871..37b477b886d 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -2694,18 +2694,17 @@ read_and_display_attr_value (unsigned long attribute, { const char *suffix = section ? strrchr (section->name, '.') : NULL; bool dwo = suffix && strcmp (suffix, ".dwo") == 0; + const char *strng; + strng = fetch_indexed_string (uvalue, this_set, offset_size, dwo, + debug_info_p ? debug_info_p->str_offsets_base : 0); if (do_wide) /* We have already displayed the form name. */ printf (_("%c(offset: 0x%s): %s"), delimiter, - dwarf_vmatoa ("x", uvalue), - fetch_indexed_string (uvalue, this_set, offset_size, dwo, - debug_info_p->str_offsets_base)); + dwarf_vmatoa ("x", uvalue), strng); else printf (_("%c(indexed string: 0x%s): %s"), delimiter, - dwarf_vmatoa ("x", uvalue), - fetch_indexed_string (uvalue, this_set, offset_size, dwo, - debug_info_p->str_offsets_base)); + dwarf_vmatoa ("x", uvalue), strng); } break;