From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20987 invoked by alias); 14 Jan 2018 16:28:36 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 20928 invoked by uid 89); 14 Jan 2018 16:28:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=Applied, 3338, Hx-languages-length:2071 X-Spam-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 14 Jan 2018 16:28:33 +0000 Received: from librem.wildebeest.org (deer0x01.wildebeest.org [172.31.17.131]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 53CFE30016A2; Sun, 14 Jan 2018 17:28:30 +0100 (CET) Received: by librem.wildebeest.org (Postfix, from userid 1000) id 05AA913FE38; Sun, 14 Jan 2018 17:28:30 +0100 (CET) Date: Sun, 14 Jan 2018 16:28:00 -0000 From: Mark Wielaard To: Petr Machata Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] libdw: dwarf_formsdata should return a signed value Message-ID: <20180114162829.GA8138@wildebeest.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q1/txt/msg00007.txt.bz2 Hi Petr, On Sun, Jan 14, 2018 at 03:22:05AM +0100, Petr Machata wrote: > The function dwarf_formsdata is used for decoding signed values, but > except for the variable-length DW_FORM_sdata, it uses unsigned > primitives to decode the value. This is not a problem for 64-bit values, > but the smaller values come decoded wrong. Fix by changing to signed > primitives for decoding the fixed-length forms. > > Add a test case that uses dwarf_aggregate_size to determine an array > size whose lower bound is -1, encoded using DW_FORM_data1, and upper > bound 255 with DW_FORM_data2. When the -1 is decoded wrongly, it comes > back as 255, and the array size is 1. The correct array size should be > 257. Thanks for the patch and testcase. The change is obviously correct. I wonder why we never noticed before. Applied to master including adding the new test files to EXTRA_DIST to make sure they get into the dist tar ball. Cheers, diff --git a/tests/ChangeLog b/tests/ChangeLog index 831532b2..758f20e6 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2018-01-14 Petr Machata + + * testfile-sizes4.o.bz2: New test file. + * testfile-sizes4.s: New test source. + * run-aggregate-size.sh: Check testfile-sizes4.o v size 257. + 2017-12-23 Mark Wielaard * backtrace-subr.sh (check_native_core): Use a lock file and try diff --git a/tests/Makefile.am b/tests/Makefile.am index 64cb5bd9..1fce4474 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -333,7 +333,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-deleted.sh run-linkmap-cut.sh linkmap-cut-lib.so.bz2 \ linkmap-cut.bz2 linkmap-cut.core.bz2 \ run-aggregate-size.sh testfile-sizes1.o.bz2 testfile-sizes2.o.bz2 \ - testfile-sizes3.o.bz2 run-peel-type.sh \ + testfile-sizes3.o.bz2 testfile-sizes4.o.bz2 testfile-sizes4.s \ + run-peel-type.sh \ run-readelf-A.sh testfileppc32attrs.o.bz2 \ testfilesparc64attrs.o.bz2 testfileppc64attrs.o.bz2 \ testfile-debug-types.bz2 \