From: Mark Wielaard <mark@klomp.org>
To: Petr Machata <pmachata@gmail.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] libdw: dwarf_formsdata should return a signed value
Date: Sun, 14 Jan 2018 16:28:00 -0000 [thread overview]
Message-ID: <20180114162829.GA8138@wildebeest.org> (raw)
In-Reply-To: <d4b8049cf28a1fafcc2ce5b7b5abab7d3908591c.1515894988.git.pmachata@gmail.com>
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 <pmachata@gmail.com>
+
+ * 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 <mark@klomp.org>
* 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 \
next prev parent reply other threads:[~2018-01-14 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-14 2:22 Petr Machata
2018-01-14 16:28 ` Mark Wielaard [this message]
[not found] ` <CAKfwACU9zq_s_W-0CierBK1PW8HDunTbZkL6-A6kRZb5SCK50A@mail.gmail.com>
2018-01-15 8:24 ` Mark Wielaard
2018-01-15 11:34 ` Petr Machata
2018-01-15 19:28 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180114162829.GA8138@wildebeest.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=pmachata@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).