From: Mark Wielaard Date: Tue, 14 Feb 2023 19:24:30 +0000 (+0100) Subject: libdw: Correct data end checkfor deref_type operand in dwarf_getlocation X-Git-Tag: elfutils-0.189~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e8306768a6d0195c01644e7c5a6fff027fd19f2;p=thirdparty%2Felfutils.git libdw: Correct data end checkfor deref_type operand in dwarf_getlocation In __libdw_intern_expression we checked for one byte too many. We only need one byte for the size and (at least one) for the uleb128 DIE reference. Signed-off-by: Mark Wielaard --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ddf14e550..e0cd8f212 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2023-02-14 Mark Wielaard + + * dwarf_getlocation.c (__libdw_intern_expression): Correct check + for deref_type. + 2023-02-10 Mark Wielaard * dwarf_getlocation.c (__libdw_intern_expression): Handle diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index 66eab3e99..553fdc986 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -546,7 +546,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order, case DW_OP_deref_type: case DW_OP_GNU_deref_type: case DW_OP_xderef_type: - if (unlikely (data + 2 >= end_data)) + if (unlikely (data + 1 >= end_data)) goto invalid; newloc->number = *data++; get_uleb128 (newloc->number2, data, end_data);