summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-03 04:42:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-03 04:42:13 (GMT)
commit9aa47d6ad51e5b1651eccb480603094a2e24d115 (patch)
treebb44fa6c48739aa7e5f69c4e8311737fe1301fda /src/H5Ocache.c
parentc1d6230290469b4b4408fec5857a835893fe7d67 (diff)
downloadhdf5-9aa47d6ad51e5b1651eccb480603094a2e24d115.zip
hdf5-9aa47d6ad51e5b1651eccb480603094a2e24d115.tar.gz
hdf5-9aa47d6ad51e5b1651eccb480603094a2e24d115.tar.bz2
[svn-r13100] Description:
Fix bug which could possibly corrupt file data if an attribute was renamed to a longer name. Tested on: FreeBSD/32 6.1 (duty)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 098746b..74083e4 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -169,19 +169,16 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
encode = H5O_MSG_SHARED->encode;
else
encode = curr_msg->type->encode;
-/* XXX: fix me */
-#ifdef NOT_YET
+#ifndef NDEBUG
+/* Sanity check that the message won't overwrite past it's allocated space */
if(!(curr_msg->flags & H5O_MSG_FLAG_SHARED)) {
size_t msg_size;
- HDfprintf(stderr, "%s: curr_msg->type->name = '%s'\n", FUNC, curr_msg->type->name);
- HDfprintf(stderr, "%s: curr_msg->raw_size = %Zu\n", FUNC, curr_msg->raw_size);
msg_size = curr_msg->type->raw_size(f, curr_msg->native);
- HDfprintf(stderr, "%s: msg_size = %Zu\n", FUNC, msg_size);
- if(msg_size > curr_msg->raw_size)
- HDfprintf(stderr, "%s: YOW!\n", FUNC);
+ msg_size = H5O_ALIGN_OH(oh, msg_size);
+ HDassert(msg_size <= curr_msg->raw_size);
} /* end if */
-#endif /* NOT_YET */
+#endif /* NDEBUG */
if((encode)(f, curr_msg->raw, curr_msg->native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
} /* end if */