From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 9BE563858D33 for ; Tue, 14 Feb 2023 19:28:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BE563858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id D843B30067DA; Tue, 14 Feb 2023 20:28:47 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id AFAFBCB993; Tue, 14 Feb 2023 20:28:47 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] libdw: Correct data end checkfor deref_type operand in dwarf_getlocation Date: Tue, 14 Feb 2023 20:28:46 +0100 Message-Id: <20230214192846.580713-1-mark@klomp.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3037.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- This wrong check caused the recent buildbot failure on some arches. libdw/ChangeLog | 5 +++++ libdw/dwarf_getlocation.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ddf14e55..e0cd8f21 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 66eab3e9..553fdc98 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); -- 2.31.1