summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2011-12-01 15:00:27 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2011-12-01 15:00:27 (GMT)
commit19f75c804a64cefd49ee7e1ac5d9ae3ea63f68cf (patch)
tree673f12153a503187cb80fb3299644d47ca17d3cf /src
parenta529e1ae551d4c2ee8c550e33563e0ae910cc136 (diff)
downloadhdf5-19f75c804a64cefd49ee7e1ac5d9ae3ea63f68cf.zip
hdf5-19f75c804a64cefd49ee7e1ac5d9ae3ea63f68cf.tar.gz
hdf5-19f75c804a64cefd49ee7e1ac5d9ae3ea63f68cf.tar.bz2
[svn-r21789] Purpose: Fix HDFFV-7833
Description: When shrinking a chunked dataset, the library fills in the unused parts of chunks that have been shrunk. The fill value buffer allocated for this purpose had a maximum size of 1 MB, but the fill was performed in a single operation. Therefore, if the amount of unused space in a chunk after being shrunk was greater than 1 MB, the library would read off the end of the fill value buffer. Changed the maximum fill buffer size to be equal to the chunk size. Tested: durandal; jam, koala, heiwa (h5committest)
Diffstat (limited to 'src')
-rw-r--r--src/H5Dchunk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 092e1b5..6a05f2d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -3476,6 +3476,7 @@ H5D_chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */
hssize_t sel_nelmts; /* Number of elements in selection */
hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
+ size_t chunk_size; /*size of a chunk */
void *chunk; /* The file chunk */
H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
uint32_t bytes_accessed; /* Bytes accessed in chunk */
@@ -3485,6 +3486,10 @@ H5D_chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_prune_fill)
+ /* Get the chunk's size */
+ HDassert(layout->u.chunk.size > 0);
+ H5_ASSIGN_OVERFLOW(chunk_size, layout->u.chunk.size, uint32_t, size_t);
+
/* Get the info for the chunk in the file */
if(H5D_chunk_lookup(dset, io_info->dxpl_id, chunk_offset,
io_info->store->chunk.index, &chk_udata) < 0)
@@ -3501,7 +3506,7 @@ H5D_chunk_prune_fill(H5D_chunk_it_ud1_t *udata)
if(H5D_fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL,
&dset->shared->dcpl_cache.fill,
dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk,
- io_info->dxpl_cache->max_temp_buf, io_info->dxpl_id) < 0)
+ chunk_size, io_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
udata->fb_info_init = TRUE;
} /* end if */