aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2012-04-20 05:25:51 +0000
committerknarf <knarf@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2012-04-20 05:25:51 +0000
commitbb4bf98cf2a708be7e0b1bcce91a7fba32a1cef6 (patch)
treef5471629f61811c04e85e54cd7630de717b4ed57
parent57ffcb1f6020cff3b1a71f1b0e8ad3fb53ab74c9 (diff)
(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
-rw-r--r--src/ChooseOutput.c2
1 files changed, 1 insertions, 1 deletions
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++)
{