diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2011-12-01 15:47:54 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2011-12-01 15:47:54 (GMT) |
commit | 4904187cabafca47201d7d1a6662f5cb5938c404 (patch) | |
tree | 0f7b5fc476ad9280cec807dcf3a65a7216bc15f5 /src/H5Dchunk.c | |
parent | 19f748cd55b9022a6b1aadd6602ebaa2266850f6 (diff) | |
download | hdf5-4904187cabafca47201d7d1a6662f5cb5938c404.zip hdf5-4904187cabafca47201d7d1a6662f5cb5938c404.tar.gz hdf5-4904187cabafca47201d7d1a6662f5cb5938c404.tar.bz2 |
[svn-r21791] Port r21789 to 1.8 branch
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/H5Dchunk.c')
-rw-r--r-- | src/H5Dchunk.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b261ea6..b9d8482 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 */ |