diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-16 04:31:09 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-07-26 22:19:11 (GMT) |
commit | d0362ce438aef8ad690d5b084d929403c9877107 (patch) | |
tree | ba42c7d25552a60f87b4d35059bd435443a52753 /src/H5Dchunk.c | |
parent | e57234b027b10c4bd0ba77b4ce9b4668ba964ffa (diff) | |
download | hdf5-d0362ce438aef8ad690d5b084d929403c9877107.zip hdf5-d0362ce438aef8ad690d5b084d929403c9877107.tar.gz hdf5-d0362ce438aef8ad690d5b084d929403c9877107.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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6b9b3ab..50cc0d0 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])) ) |