summaryrefslogtreecommitdiffstats
path: root/src/H5B2cache.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-07-01 22:08:11 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-07-01 22:08:11 (GMT)
commit9804fed58f4f30843d406861a2daf67944c244de (patch)
tree37ef75018769aa13ad604dc9be42dfd81d8a9812 /src/H5B2cache.c
parent980db9e85b902bcd0e183e00c5ebe02ec365dc22 (diff)
downloadhdf5-9804fed58f4f30843d406861a2daf67944c244de.zip
hdf5-9804fed58f4f30843d406861a2daf67944c244de.tar.gz
hdf5-9804fed58f4f30843d406861a2daf67944c244de.tar.bz2
[svn-r27320] Fix uninitialized memory write valgrind errors in trunk. Did this by modifying
metadata cache clients to clear unused memory in the buffer after serializing. Tested: ummon; jam, koala, ostrich (h5committest)
Diffstat (limited to 'src/H5B2cache.c')
-rw-r--r--src/H5B2cache.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 64e304c..9e43ff8 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -393,7 +393,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__cache_hdr_serialize() */
@@ -698,6 +698,11 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
+#ifdef H5_CLEAR_MEMORY
+ /* Clear rest of internal node */
+ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
+#endif /* H5_CLEAR_MEMORY */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_int_serialize() */
@@ -970,6 +975,11 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
+#ifdef H5_CLEAR_MEMORY
+ /* Clear rest of leaf node */
+ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
+#endif /* H5_CLEAR_MEMORY */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_leaf_serialize() */