diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-07-10 08:22:48 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-07-19 23:03:18 (GMT) |
commit | fc76c7785251482a26f31efabb10d38725facb6a (patch) | |
tree | 3eecc5d211f842b0a5e0915c1965631a27468676 /src/H5Ddeprec.c | |
parent | 45724d8082ad1dc0f22262add83f4ffa526c4ac4 (diff) | |
download | hdf5-fc76c7785251482a26f31efabb10d38725facb6a.zip hdf5-fc76c7785251482a26f31efabb10d38725facb6a.tar.gz hdf5-fc76c7785251482a26f31efabb10d38725facb6a.tar.bz2 |
Fix for HDFFV-10217 infinite loop in H5VM_power2up().
The function H5VM_power2up() returns the next power of 2 for n.
When n exceeds 2^63, it overflows and becomes 0 causing the infinite looping.
The fix ensures that the function checks for n >= 2^63 and returns 0.
Diffstat (limited to 'src/H5Ddeprec.c')
-rw-r--r-- | src/H5Ddeprec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 8d9461c..0807048 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -329,8 +329,11 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) dataset->shared->cache.chunk.scaled_dims[u] > dataset->shared->cache.chunk.nslots)) update_chunks = TRUE; + if( !(scaled_power2up = H5VM_power2up(scaled)) ) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") + /* Check if the number of bits required to encode the scaled size value changed */ - if(dataset->shared->cache.chunk.scaled_power2up[u] != (scaled_power2up = H5VM_power2up(scaled))) { + if(dataset->shared->cache.chunk.scaled_power2up[u] != scaled_power2up) { /* Update the 'power2up' & 'encode_bits' values for the current dimension */ dataset->shared->cache.chunk.scaled_power2up[u] = scaled_power2up; dataset->shared->cache.chunk.scaled_encode_bits[u] = H5VM_log2_gen(scaled_power2up); |