mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
PR29171, invalid read causing SIGSEGV
The fix here is to pass "section" down to read_and_display_attr_value. The test in read_and_display_attr_value is a little bit of hardening. PR 29171 * dwarf.c (display_debug_macro, display_debug_names): Pass section to read_and_display_attr_value2. (read_and_display_attr_value): Don't attempt to check for .dwo section name when section is NULL.
This commit is contained in:
@ -2717,7 +2717,7 @@ read_and_display_attr_value (unsigned long attribute,
|
|||||||
case DW_FORM_strx4:
|
case DW_FORM_strx4:
|
||||||
if (!do_loc)
|
if (!do_loc)
|
||||||
{
|
{
|
||||||
const char *suffix = strrchr (section->name, '.');
|
const char *suffix = section ? strrchr (section->name, '.') : NULL;
|
||||||
bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
|
bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
|
||||||
|
|
||||||
if (do_wide)
|
if (do_wide)
|
||||||
@ -6273,8 +6273,9 @@ display_debug_macro (struct dwarf_section *section,
|
|||||||
SAFE_BYTE_GET_AND_INC (val, desc, 1, end);
|
SAFE_BYTE_GET_AND_INC (val, desc, 1, end);
|
||||||
curr
|
curr
|
||||||
= read_and_display_attr_value (0, val, 0,
|
= read_and_display_attr_value (0, val, 0,
|
||||||
start, curr, end, 0, 0, offset_size,
|
start, curr, end, 0, 0,
|
||||||
version, NULL, 0, NULL,
|
offset_size, version,
|
||||||
|
NULL, 0, section,
|
||||||
NULL, ' ', -1);
|
NULL, ' ', -1);
|
||||||
if (n != nargs - 1)
|
if (n != nargs - 1)
|
||||||
printf (",");
|
printf (",");
|
||||||
@ -10310,7 +10311,7 @@ display_debug_names (struct dwarf_section *section, void *file)
|
|||||||
unit_start, entryptr, unit_end,
|
unit_start, entryptr, unit_end,
|
||||||
0, 0, offset_size,
|
0, 0, offset_size,
|
||||||
dwarf_version, NULL,
|
dwarf_version, NULL,
|
||||||
(tagno < 0), NULL,
|
(tagno < 0), section,
|
||||||
NULL, '=', -1);
|
NULL, '=', -1);
|
||||||
}
|
}
|
||||||
++tagno;
|
++tagno;
|
||||||
|
Reference in New Issue
Block a user