dwarf_loader: Handle unsupported_tag return in die__process_class()
When die__process_tag() gets some tag it hasn't support for, it returns the special zeroed 'unsupported_tag' struct tag pointer, but die__process_class() wasn't handling that, assuming since it isn't NULL that it is a valid 'struct tag' pointer and proceeded to try to use its ->priv area, b00m. So catch that and print an "unsuported tag FOO" for that case, this makes the code way more robust as any unsupported tag will not cause a segfault, just a warning. So, for the case in the Bugtracker tag below, we don't segfault instead we show just that DW_TAG_variant_part isn't supported when found inside a DW_TAG_structure_type (or DW_TAG_class_type) as is the case with ADA 95. Reported-by: Tom de Vries Bugtracker: https://github.com/acmel/dwarves/issues/9#issuecomment-697250246 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
3d616609ee
commit
010a71e181
|
@ -1350,6 +1350,11 @@ static int die__process_class(Dwarf_Die *die, struct type *class,
|
|||
if (tag == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
if (tag == &unsupported_tag) {
|
||||
tag__print_not_supported(dwarf_tag(die));
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
|
||||
if (cu__table_add_tag(cu, tag, &id) < 0) {
|
||||
|
|
Loading…
Reference in New Issue