From b1eb1b3ee8693e2a56b074315b521c66255acca1 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 1 Sep 2016 17:24:24 -0500 Subject: 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. --- src/H5Odtype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index e51d319..eae542b 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -519,7 +519,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) -- cgit v0.12