libdw: Don't pass NULL to dwarf_peel_type
authorMark Wielaard <mark@klomp.org>
Mon, 18 Oct 2021 12:35:20 +0000 (14:35 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 18 Oct 2021 12:35:33 +0000 (14:35 +0200)
commite3e70782a1d1a246844215991bbd2d6b60d0aa41
treea0c9cd162960f857fd5a016205d53dd6100a96c0
parentc3a6a9dfc6ed0c24ab2d11b2d71f425b479575c9
libdw: Don't pass NULL to dwarf_peel_type

commit c3a6a9dfc "libdw: Use signedness of subrange type to
determine array bounds" introduced a type check on a DIE which
exposed a latent bug in the get_type function. Even if the type
of a DIE couldn't be determined it would call dwarf_peel_type
on it. The gcc undefined sanitizer would flag this as being
undefined behaviour because the second argument of the function
is marked as non-NULL. Fix this by checking we actually have
a non-NULL type DIE.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdw/ChangeLog
libdw/dwarf_aggregate_size.c