summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5B2cache.c12
-rw-r--r--src/H5Bcache.c8
-rw-r--r--src/H5EAcache.c10
-rw-r--r--src/H5FAcache.c6
-rw-r--r--src/H5Fsuper_cache.c4
-rw-r--r--src/H5Gcache.c4
-rw-r--r--src/H5HLcache.c12
-rw-r--r--src/H5SMcache.c6
8 files changed, 46 insertions, 16 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() */
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index dfa4dab..d071712 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -338,10 +338,16 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
/* Encode the final key */
if(shared->type->encode(shared, image, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
+ image += shared->sizeof_rkey;
} /* end if */
/* Sanity check */
- HDassert((size_t)((const uint8_t *)image - (const uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) <= len);
+
+#ifdef H5_CLEAR_MEMORY
+ /* Clear rest of node */
+ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
+#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 0d83fb3..8a05282 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -488,7 +488,7 @@ H5EA__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);
END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
@@ -785,7 +785,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
@@ -1141,7 +1141,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
@@ -1494,7 +1494,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
@@ -1816,7 +1816,7 @@ H5EA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 298eb56..b95da40 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -407,7 +407,7 @@ H5FA__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);
END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */
@@ -704,7 +704,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
@@ -976,7 +976,7 @@ H5FA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
UINT32ENCODE(image, metadata_chksum);
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 8cc8299..ac1f840 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -716,7 +716,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
} /* end else */
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -976,7 +976,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len,
image += 8 + drvinfo->len;
/* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= len);
+ HDassert((size_t)(image - (uint8_t *)_image) == len);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index 8dfecb1..f765b41 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -316,8 +316,10 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len,
if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize")
+#ifdef H5_CLEAR_MEMORY
/* Clear rest of symbol table node */
- HDmemset(image, 0, sym->node_size - (size_t)(image - (uint8_t *)_image));
+ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
+#endif /* H5_CLEAR_MEMORY */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 17ded00..2054e34 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -560,7 +560,19 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len,
/* Copy the heap data block into the cache image */
HDmemcpy(image, heap->dblk_image, heap->dblk_size);
+
+ /* Sanity check */
+ HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len);
} /* end if */
+ else {
+ /* Sanity check */
+ HDassert((size_t)(image - (uint8_t *)_image) <= len);
+
+#ifdef H5_CLEAR_MEMORY
+ /* Clear rest of local heap */
+ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
+#endif /* H5_CLEAR_MEMORY */
+ } /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL__cache_prefix_serialize() */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index d8c0824..293088c 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -675,13 +675,13 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len,
computed_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
UINT32ENCODE(image, computed_chksum);
+ /* sanity check */
+ HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size);
+
#ifdef H5_CLEAR_MEMORY
HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image)));
#endif /* H5_CLEAR_MEMORY */
- /* sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM__cache_list_serialize() */