summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-16 04:31:09 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-16 04:31:09 (GMT)
commitfa5d96dc5efc463015b4455e6ed2b96346b3b12f (patch)
treee53c588e8ca90a1cd508e87c6b4b5656b2b2f3fe /src/H5Dchunk.c
parentec31438afdaf575368938e930eb3af0865a342b3 (diff)
downloadhdf5-fa5d96dc5efc463015b4455e6ed2b96346b3b12f.zip
hdf5-fa5d96dc5efc463015b4455e6ed2b96346b3b12f.tar.gz
hdf5-fa5d96dc5efc463015b4455e6ed2b96346b3b12f.tar.bz2
Fixed division-by-zero issues
Description: Fixed HDFFV-10481 and HDFFV-10477, division by 0. Fixed another occurrence beside what were reported. Also, changed a local variable to avoid an unnecessary cast. Platforms tested: Linux/64 (jelly) Linux/32 (jam) Darwin (osx1010test)
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index e3f6410..7b8377d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -947,6 +947,9 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
/* Initial scaled dimension sizes */
+ if(dset->shared->layout.u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL,
+ "chunk size must be > 0, dim = %u ", u)
rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u];
if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) )