From bb4bf98cf2a708be7e0b1bcce91a7fba32a1cef6 Mon Sep 17 00:00:00 2001 From: knarf Date: Fri, 20 Apr 2012 05:25:51 +0000 Subject: (At least) one place in IOASCII assumes maxdim<=3 by only allocating 3 entries of an array but then writing maxdim entries. The thorn TestArrays tests 4D arrays in its testsuite and while this seems to work on 64bit machines, it gives a segfault on 32bit machines (plus valgrind complaining loudly). Allocating maxdim entries (like also done elsewhere in the file) solves this problem, as done in this patch. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@218 94b1c47f-dcfd-45ef-a468-0854c0e9e350 --- src/ChooseOutput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c index 1597399..46c6a94 100644 --- a/src/ChooseOutput.c +++ b/src/ChooseOutput.c @@ -143,7 +143,7 @@ void IOASCII_Choose2D (CCTK_ARGUMENTS) maxdim = CCTK_MaxDim (); myGH = CCTK_GHExtension (cctkGH, "IOASCII"); - myGH->sp2xyz = malloc (3 * sizeof (int *)); + myGH->sp2xyz = malloc (maxdim * sizeof (int *)); for (i = 0; i < maxdim; i++) { -- cgit v1.2.3