diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2019-12-05 18:35:20 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2019-12-05 18:35:20 (GMT) |
commit | 0662f060b2e5917b70360ed10aca3993b60f1434 (patch) | |
tree | eca4dc24036fcc3f3365b0cd2045b23f13fa3c25 /src | |
parent | 3726715625d146ddffc4236b8de5cc601c87b737 (diff) | |
download | hdf5-0662f060b2e5917b70360ed10aca3993b60f1434.zip hdf5-0662f060b2e5917b70360ed10aca3993b60f1434.tar.gz hdf5-0662f060b2e5917b70360ed10aca3993b60f1434.tar.bz2 |
Fix the segmentation fault when h5dump "vds_virt_0.h5", which is a test file produced by test/vds.c in the develop
branch. The fix: verify the decoded version for hyperslab selection is within the correct range.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Shyper.c | 3 | ||||
-rw-r--r-- | src/H5Spkg.h | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 55913e0..4f96197 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2481,6 +2481,9 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection") + if(version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ flags = *(pp)++; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 3edf4c3..518c495 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -37,8 +37,9 @@ #define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR) /* Versions for H5S_SEL_HYPER selection info */ -#define H5S_HYPER_VERSION_1 1 -#define H5S_HYPER_VERSION_2 2 +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 +#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_2 /* Versions for H5S_SEL_POINTS selection info */ #define H5S_POINT_VERSION_1 1 |