summaryrefslogtreecommitdiffstats
path: root/src/H5HLcache.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2010-07-16 16:32:49 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2010-07-16 16:32:49 (GMT)
commitc22b8a94f2b6920e03f8390415269f9333eeb077 (patch)
tree44da189a5048fd7a9de087049e4f80119e0451ab /src/H5HLcache.c
parent0dce71a0a30314da545f1f90a26f537c467b043a (diff)
downloadhdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.zip
hdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.tar.gz
hdf5-c22b8a94f2b6920e03f8390415269f9333eeb077.tar.bz2
[svn-r19076] Purpose: Fix bug 1951
Description: A bug introduced in 1.8.5 causes local heap data blocks to be mis-aligned when sizeof_offsets + 2*sizeof_lengths is not a multiple of 8. In this case, the address of the data block as stored in the heap prefix is aligned but the actual data block is not. This causes files created with these sizes to be corrupted, and prevents uncorrupted files with these sizes to be unreadable. Modified local heap code to account for alignment. Tested: jam, amani, linew (h5committest)
Diffstat (limited to 'src/H5HLcache.c')
-rw-r--r--src/H5HLcache.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 238dce6..51d60f9 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -330,6 +330,11 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Check if the current buffer from the speculative read already has the heap data */
if(spec_read_size >= (heap->prfx_size + heap->dblk_size)) {
+ /* Set p to the start of the data block. This is necessary
+ * because there may be a gap between the used portion of the
+ * prefix and the data block due to alignment constraints. */
+ p = buf + heap->prfx_size;
+
/* Copy the heap data from the speculative read buffer */
HDmemcpy(heap->dblk_image, p, heap->dblk_size);
} /* end if */
@@ -435,6 +440,11 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Check if the local heap is a single object in cache */
if(heap->single_cache_obj) {
+ /* Set p to the start of the data block. This is necessary because
+ * there may be a gap between the used portion of the prefix and the
+ * data block due to alignment constraints. */
+ p = buf + heap->prfx_size;
+
/* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap);