]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Correct data end checkfor deref_type operand in dwarf_getlocation
authorMark Wielaard <mark@klomp.org>
Tue, 14 Feb 2023 19:24:30 +0000 (20:24 +0100)
committerMark Wielaard <mark@klomp.org>
Tue, 14 Feb 2023 19:24:30 +0000 (20:24 +0100)
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 <mark@klomp.org>
libdw/ChangeLog
libdw/dwarf_getlocation.c

index ddf14e550e64c23119e3a7708162939d3a803dab..e0cd8f2125aa991b1055b09bf0a681a273f251d6 100644 (file)
@@ -1,3 +1,8 @@
+2023-02-14  Mark Wielaard  <mark@klomp.org>
+
+       * dwarf_getlocation.c (__libdw_intern_expression): Correct check
+       for deref_type.
+
 2023-02-10  Mark Wielaard  <mark@klomp.org>
 
        * dwarf_getlocation.c (__libdw_intern_expression): Handle
index 66eab3e99db2533617717ace523c23d716d56249..553fdc986427dc253ab2a99293d3682c9fe551ac 100644 (file)
@@ -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);