[binutils-gdb] pr34322: assertion failure in get_or_create_member_type
Alan Modra
amodra@sourceware.org
Sat Jul 4 10:55:53 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=58b8db1ca4e6021161511cb24b18a48fcf8e5546
commit 58b8db1ca4e6021161511cb24b18a48fcf8e5546
Author: Alan Modra <amodra@gmail.com>
Date: Sat Jul 4 19:57:43 2026 +0930
pr34322: assertion failure in get_or_create_member_type
I thought about warning "DW_TAG_member without struct/union parent"
here but decided that doesn't help much as the warning is disconnected
from output. As it is the --map-global-vars code silently ignores
unexpected attributes that might be found in fuzzed files. I'm fine
with that too.
PR 34322
* dwarf.c (get_or_create_member_type): Return NULL on NULL parent.
(insert_element_in_list): Ignore DW_TAG_member without struct
or union parent.
Diff:
---
binutils/dwarf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index f915495f6b3..829bcb761f7 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2919,7 +2919,8 @@ display_member_type (const member_type mt)
static member_type *
get_or_create_member_type (member_parent *parent, uint64_t die_offset)
{
- assert (parent != NULL);
+ if (parent == NULL)
+ return NULL;
if (parent->member_tail == NULL
|| parent->member_tail->die_offset != die_offset)
{
@@ -3371,6 +3372,8 @@ insert_element_in_list (enum dwarf_tag dw_tag,
mt = get_or_create_member_type (union_type_list.tail, die_offset);
else
mt = get_or_create_member_type (struct_type_list.tail, die_offset);
+ if (mt == NULL)
+ break;
if (dw_attr == DW_AT_name)
{
More information about the Binutils-cvs
mailing list