summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-04-26 22:57:22 (GMT)
committerGitHub <noreply@github.com>2023-04-26 22:57:22 (GMT)
commitbd7616cf98ae52e77f710a16fb4d334be3cb5ce9 (patch)
treec02bb657e6af4183154ae03a4a4af6fd5e5a83f5 /src
parentca27cf94a2832bc7eb06975070319f827bcf4bbd (diff)
downloadhdf5-bd7616cf98ae52e77f710a16fb4d334be3cb5ce9.zip
hdf5-bd7616cf98ae52e77f710a16fb4d334be3cb5ce9.tar.gz
hdf5-bd7616cf98ae52e77f710a16fb4d334be3cb5ce9.tar.bz2
Fix v1 object header gap bug in H5Ocopy (#2785)
Diffstat (limited to 'src')
-rw-r--r--src/H5Ocopy.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 926d0da..9852d1f 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -532,10 +532,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;