This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libdw: dwarf_formsdata should return a signed value

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.


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.
+	* Check testfile-sizes4.o v size 257.
 2017-12-23  Mark Wielaard  <>
 	* (check_native_core): Use a lock file and try
diff --git a/tests/ b/tests/
index 64cb5bd9..1fce4474 100644
--- a/tests/
+++ b/tests/
@@ -333,7 +333,8 @@ EXTRA_DIST = \ \
 	     linkmap-cut.bz2 linkmap-cut.core.bz2 \ testfile-sizes1.o.bz2 testfile-sizes2.o.bz2 \
-	     testfile-sizes3.o.bz2 \
+	     testfile-sizes3.o.bz2 testfile-sizes4.o.bz2 testfile-sizes4.s \
+ \ testfileppc32attrs.o.bz2 \
 	     testfilesparc64attrs.o.bz2 testfileppc64attrs.o.bz2 \
 	     testfile-debug-types.bz2 \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]