summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2018-11-15 20:57:26 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2018-11-15 20:57:26 (GMT)
commitc132cb5565de02fd4e1e2cfe8ea7b89b21f785ac (patch)
treec76708ca8aed48d03dba4e9604083d9662f4f02c /src/H5Dchunk.c
parent1d89a55590d106ea4d242402d0cd57a9d1ce5252 (diff)
downloadhdf5-c132cb5565de02fd4e1e2cfe8ea7b89b21f785ac.zip
hdf5-c132cb5565de02fd4e1e2cfe8ea7b89b21f785ac.tar.gz
hdf5-c132cb5565de02fd4e1e2cfe8ea7b89b21f785ac.tar.bz2
HDFFV-10571: Minor change - adding the error check right after decoding of chunk dimension for safeguard.
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 659d580..00a6b50 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -684,6 +684,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
const hsize_t *curr_dims, const hsize_t *max_dims)
{
unsigned u; /* Local index variable */
+
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -695,10 +696,9 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
/* Compute the # of chunks in dataset dimensions */
for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
- /* Just in case that something goes very wrong, such as file corruption. */
- if(layout->dim[u] == 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk dimension must be positive: layout->dim[%u] = %u ", u, layout->dim[u])
-
+ /* Sanity check */
+ HDassert(layout->dim[u] > 0);
+
/* Round up to the next integer # of chunks, to accommodate partial chunks */
layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
if(H5S_UNLIMITED == max_dims[u])