diff options
author | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2020-03-12 20:44:43 (GMT) |
---|---|---|
committer | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2020-03-12 20:44:43 (GMT) |
commit | 19464e2172e5b5d15d4a8ebaee57ef4bc671d897 (patch) | |
tree | 688e7d8063c6dd6f4594b1fe4784951e7aac95ce /src/H5Sall.c | |
parent | a64e09b1aec583e5dd4696e04e0320b786120d38 (diff) | |
download | hdf5-19464e2172e5b5d15d4a8ebaee57ef4bc671d897.zip hdf5-19464e2172e5b5d15d4a8ebaee57ef4bc671d897.tar.gz hdf5-19464e2172e5b5d15d4a8ebaee57ef4bc671d897.tar.bz2 |
Verify the decoded version for "all" and "none" selection.
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r-- | src/H5Sall.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c index d57e6c1..86ab0d8 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -516,7 +516,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf) /* Store the preamble information */ UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(buf, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */ UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */ @@ -544,13 +544,23 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_deserialize(H5S_t *space, const uint8_t H5_ATTR_UNUSED *buf) +H5S_all_deserialize(H5S_t *space, const uint8_t *buf) { + uint32_t version; /* Decoded version */ + uint8_t *p; /* Temporary pointer to buf */ herr_t ret_value; /* return value */ FUNC_ENTER_NOAPI(FAIL) HDassert(space); + HDassert(buf); + + p = buf + 4; + /* Decode version */ + UINT32DECODE(p, version); + + if(version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection") /* Change to "all" selection */ if((ret_value = H5S_select_all(space, TRUE)) < 0) |