mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 23:26:51 +08:00
Don't crash is dwarf_decode_macro_bytes's 'body' is NULL, even when '!is_define'
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1715008 On commit 7bede82892a06e6c26989803e70f53697392dcf9 ("Don't crash if dwarf_decode_macro_bytes's 'body' is NULL"), I was too strict when checking if 'body' is NULL: the check only comprised the case when 'is_define' is true. However, the corruption of .debug_macro by rpmbuild's "debugedit" also affects the case when 'is_define' is false, i.e., when the macro is being undefined. This commit improves the check and covers both cases now. This has been tested on Fedora 30 with a problematic debuginfo, and I don't see a segfault anymore. OK to push? gdb/ChangeLog: 2019-05-29 Sergio Durigan Junior <sergiodj@redhat.com> Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192 Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1715008 * dwarf2read.c (dwarf_decode_macro_bytes): Move check to see if 'body' is NULL to the outter 'if', protecting the '!is_define' situation as well.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2019-05-29 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||||
|
|
||||||
|
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
|
||||||
|
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1715008
|
||||||
|
* dwarf2read.c (dwarf_decode_macro_bytes): Move check to see if
|
||||||
|
'body' is NULL to the outter 'if', protecting the '!is_define'
|
||||||
|
situation as well.
|
||||||
|
|
||||||
2019-05-29 Tom Tromey <tromey@adacore.com>
|
2019-05-29 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* dwarf2read.c (partial_die_parent_scope): Call dwarf_tag_name.
|
* dwarf2read.c (partial_die_parent_scope): Call dwarf_tag_name.
|
||||||
|
@ -24648,25 +24648,22 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu,
|
|||||||
is_define ? _("definition") : _("undefinition"),
|
is_define ? _("definition") : _("undefinition"),
|
||||||
line == 0 ? _("zero") : _("non-zero"), line, body);
|
line == 0 ? _("zero") : _("non-zero"), line, body);
|
||||||
|
|
||||||
if (is_define)
|
if (body == NULL)
|
||||||
{
|
{
|
||||||
if (body != NULL)
|
/* Fedora's rpm-build's "debugedit" binary
|
||||||
parse_macro_definition (current_file, line, body);
|
corrupted .debug_macro sections.
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Fedora's rpm-build's "debugedit" binary
|
|
||||||
corrupted .debug_macro sections.
|
|
||||||
|
|
||||||
For more info, see
|
For more info, see
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
|
https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
|
||||||
complaint (_("debug info gives %s invalid macro definition "
|
complaint (_("debug info gives %s invalid macro %s "
|
||||||
"without body (corrupted?) at line %d"
|
"without body (corrupted?) at line %d "
|
||||||
"on file %s"),
|
"on file %s"),
|
||||||
at_commandline ? _("command-line")
|
at_commandline ? _("command-line") : _("in-file"),
|
||||||
: _("in-file"),
|
is_define ? _("definition") : _("undefinition"),
|
||||||
line, current_file->filename);
|
line, current_file->filename);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (is_define)
|
||||||
|
parse_macro_definition (current_file, line, body);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdb_assert (macinfo_type == DW_MACRO_undef
|
gdb_assert (macinfo_type == DW_MACRO_undef
|
||||||
|
Reference in New Issue
Block a user