summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2017-11-13 22:54:35 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2017-11-13 22:54:35 (GMT)
commitdf45abd0f69b40f2755bd0f5eb4217564e871deb (patch)
treeb41438275e4d933c0c1ebaa623b6f213b5227b11 /src
parentc592c7b423559d2be9bf3f7de3aedafc28b05de8 (diff)
parentbca20b40b4966552a844051c3d912d6aec50592f (diff)
downloadhdf5-df45abd0f69b40f2755bd0f5eb4217564e871deb.zip
hdf5-df45abd0f69b40f2755bd0f5eb4217564e871deb.tar.gz
hdf5-df45abd0f69b40f2755bd0f5eb4217564e871deb.tar.bz2
Merge pull request #770 in HDFFV/hdf5 from ~NFORTNE2/hdf5_naf:develop to develop
* commit 'bca20b40b4966552a844051c3d912d6aec50592f': Initialize hid_t variables in test_Attr_bug9. Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case.
Diffstat (limited to 'src')
-rw-r--r--src/H5Oalloc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 3512d3e..478d950 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -2434,16 +2434,17 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno)
oh->nmesgs++;
/* Initialize new null message to make the chunk large enough */
- oh->mesg[oh->nmesgs].type = H5O_MSG_NULL;
- oh->mesg[oh->nmesgs].dirty = TRUE;
- oh->mesg[oh->nmesgs].native = NULL;
- oh->mesg[oh->nmesgs].raw = old_image + new_size + sizeof_msghdr - sizeof_chksum;
- oh->mesg[oh->nmesgs].raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size),
+ curr_msg = &oh->mesg[oh->nmesgs - 1];
+ curr_msg->type = H5O_MSG_NULL;
+ curr_msg->dirty = TRUE;
+ curr_msg->native = NULL;
+ curr_msg->raw = old_image + new_size + sizeof_msghdr - sizeof_chksum;
+ curr_msg->raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size),
sizeof_msghdr) - sizeof_msghdr;
- oh->mesg[oh->nmesgs].chunkno = chunkno;
+ curr_msg->chunkno = chunkno;
/* update the new chunk size */
- new_size += oh->mesg[oh->nmesgs].raw_size + sizeof_msghdr;
+ new_size += curr_msg->raw_size + sizeof_msghdr;
} /* end if */
/* Check for changing the chunk #0 data size enough to need adjusting the flags */