Skip to content

Commit 2d5b241

Browse files
author
philippe
committed
Fix 383275 - massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr' failed
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 0af2905 commit 2d5b241

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ where XXXXXX is the bug number as listed below.
4646
382407 vg_perf needs "--terse" command line option
4747
382515 "Assertion 'di->have_dinfo' failed." on wine's dlls/mscoree/tests/mscoree.c
4848
382998 xml-socket doesn't work
49+
383275 massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr' failed
4950

5051
Release 3.13.0 (15 June 2017)
5152
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

coregrind/m_xarray.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@ void VG_(hintSizeXA) ( XArray* xa, Word n)
149149
vg_assert(xa->usedsizeE == 0);
150150
vg_assert(xa->totsizeE == 0);
151151
vg_assert(!xa->arr);
152-
xa->arr = xa->alloc_fn(xa->cc, n * xa->elemSzB);
153-
xa->totsizeE = n;
152+
if (n > 0) {
153+
xa->arr = xa->alloc_fn(xa->cc, n * xa->elemSzB);
154+
xa->totsizeE = n;
155+
}
154156
}
155157

156158
static inline void ensureSpaceXA ( XArray* xa )

0 commit comments

Comments
 (0)