]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 383275 - massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr...
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 8 Aug 2017 19:52:03 +0000 (19:52 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 8 Aug 2017 19:52:03 +0000 (19:52 +0000)
When a massif xtree snapshot is taken when no allocation was done,
the xtree contains no exe context.
The data structure ips_order_xecu is then szied to 0 using VG_(hintSizeXA).
m_xarray.c then allocates an empty array, while later on, a zero size
is expected to correspond to no allocated array.

Fix the problem in m_xarray.c, by not doing any allocation if the
size hint is 0.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16469

NEWS
coregrind/m_xarray.c

diff --git a/NEWS b/NEWS
index bb60b81abe7d34e3ed910507c87968da2cea0b5e..516c4cc62e2a0b0502a2b664508af8228e2f4f9c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ where XXXXXX is the bug number as listed below.
 382407  vg_perf needs "--terse" command line option
 382515  "Assertion 'di->have_dinfo' failed." on wine's dlls/mscoree/tests/mscoree.c
 382998  xml-socket doesn't work
+383275  massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr' failed
 
 Release 3.13.0 (15 June 2017)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index c5c9e845080bc361ab6559ed6a2860778582157b..34d01ba17dd7a462b4ca883235c9f9afe7f0b39a 100644 (file)
@@ -149,8 +149,10 @@ void VG_(hintSizeXA) ( XArray* xa, Word n)
    vg_assert(xa->usedsizeE == 0);
    vg_assert(xa->totsizeE == 0);
    vg_assert(!xa->arr);
-   xa->arr = xa->alloc_fn(xa->cc, n * xa->elemSzB);
-   xa->totsizeE = n;
+   if (n > 0) {
+      xa->arr = xa->alloc_fn(xa->cc, n * xa->elemSzB);
+      xa->totsizeE = n;
+   }
 }
 
 static inline void ensureSpaceXA ( XArray* xa )