summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2016-09-01 22:24:24 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2016-10-05 16:24:39 (GMT)
commit2e7e1899d3d7131bcbad65233ba713f6b79e2d69 (patch)
tree2bf71e9aa7b55555ad48462bbe78eb02962b5ff2
parentb2cb046d514861c54bd33a1ac85aa67ded3e240d (diff)
downloadhdf5-2e7e1899d3d7131bcbad65233ba713f6b79e2d69.zip
hdf5-2e7e1899d3d7131bcbad65233ba713f6b79e2d69.tar.gz
hdf5-2e7e1899d3d7131bcbad65233ba713f6b79e2d69.tar.bz2
Replace assertion in H5O_dtype_decode_helper for number of array dimensions with a check and error. The assertion was inappropriate because it is operating on data read from the file, which the library does not always have direct control of.
-rw-r--r--src/H5Odtype.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 622a18e..2284634 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -518,7 +518,8 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
dt->shared->u.array.ndims = *(*pp)++;
/* Double-check the number of dimensions */
- HDassert(dt->shared->u.array.ndims <= H5S_MAX_RANK);
+ if(dt->shared->u.array.ndims > H5S_MAX_RANK)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "too many dimensions for array datatype")
/* Skip reserved bytes, if version has them */
if(version < H5O_DTYPE_VERSION_3)