aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorcott <schnetter@cct.lsu.edu>2005-07-13 14:05:00 +0000
committercott <schnetter@cct.lsu.edu>2005-07-13 14:05:00 +0000
commit156afa0204af8419cb3ebacb88f6e4aefdfb361c (patch)
treeebc271ac8dfa407687f9868d258c581011a0b0e4 /Carpet
parentc8927794f66fae958507e7c0fcf30df79bf45273 (diff)
Fixed critical bug in Checkpointing / Zero-Variable groups
Apparently there are groups with 0 variables. For them CCTK_FirstVarIndexI(group) returns -2. Since IOUtil does not check the validity of the varindex for which it creates an IO request, this can potentially lead to memory corruption and in fact does so on the Itanium-2 architecture. Fix: The checkpointing routine now does nothing for variable groups with 0 variables. darcs-hash:20050713140545-34d71-d9966cc8d510dd7a85a42ef7dc683491b2d2c895.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
index 583afda98..47757df5a 100644
--- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
+++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
@@ -734,7 +734,8 @@ static int Checkpoint (const cGH* const cctkGH, int called_from)
for (int group = CCTK_NumGroups () - 1; group >= 0; group--) {
/* only dump groups which have storage assigned */
- if (CCTK_QueryGroupStorageI (cctkGH, group) <= 0) {
+ if (CCTK_QueryGroupStorageI (cctkGH, group) <= 0 ||
+ CCTK_NumVarsInGroupI(group) == 0) {
continue;
}