summaryrefslogtreecommitdiffstats
path: root/src/H5Ocopy.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-04-30 18:56:22 (GMT)
committerGitHub <noreply@github.com>2023-04-30 18:56:22 (GMT)
commit30d3b1e48e55c15217d6a400b3ac8c927d5003d3 (patch)
treec9227aab24fdba11c83c25c5ddf1b4c0e84e2db7 /src/H5Ocopy.c
parentba9ebcbb4d677f11051a07b5a4346b1191b78eed (diff)
downloadhdf5-30d3b1e48e55c15217d6a400b3ac8c927d5003d3.zip
hdf5-30d3b1e48e55c15217d6a400b3ac8c927d5003d3.tar.gz
hdf5-30d3b1e48e55c15217d6a400b3ac8c927d5003d3.tar.bz2
Fix v1 object header gap bug in H5Ocopy (#2785) (#2833)
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r--src/H5Ocopy.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index abd1f0b..90c7ed8 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -664,10 +664,15 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5
HDassert((oh_dst->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1);
/* Determine whether to create gap or NULL message */
- if (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst))
+ if ((oh_dst->version > H5O_VERSION_1) && (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst)))
dst_oh_gap = delta;
- else
+ else {
+ /* NULL message must be at least size of message header */
+ if (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst))
+ delta = H5O_SIZEOF_MSGHDR_OH(oh_dst);
+
dst_oh_null = delta;
+ }
/* Increase destination object header size */
dst_oh_size += delta;