diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2020-03-19 23:11:07 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2020-03-19 23:11:07 (GMT) |
commit | 3656fb07eff142994f10d9b47d7dd13e9ec5013b (patch) | |
tree | 10bf21ba25e395c1a985a5ff333a79da9541d65b | |
parent | fbda71a49e85648fcf45b491b5eebea74d4e5941 (diff) | |
parent | 3b2db5eb19594fa44357e63e36f3b294fbae463d (diff) | |
download | hdf5-3656fb07eff142994f10d9b47d7dd13e9ec5013b.zip hdf5-3656fb07eff142994f10d9b47d7dd13e9ec5013b.tar.gz hdf5-3656fb07eff142994f10d9b47d7dd13e9ec5013b.tar.bz2 |
Merge pull request #2454 in HDFFV/hdf5 from ~VCHOI/my_third_fork:bugfix/v112_seg_fault_sel_compat to hdf5_1_12
* commit '3b2db5eb19594fa44357e63e36f3b294fbae463d':
Merge pull request #2451 in HDFFV/hdf5 from ~VCHOI/my_third_fork:bugfix/develop_seg_fault_sel_compat to develop
-rw-r--r-- | src/H5Rint.c | 8 | ||||
-rw-r--r-- | src/H5Sall.c | 3 | ||||
-rw-r--r-- | src/H5Snone.c | 3 | ||||
-rw-r--r-- | src/H5Spkg.h | 11 | ||||
-rw-r--r-- | src/H5Spoint.c | 3 |
5 files changed, 23 insertions, 5 deletions
diff --git a/src/H5Rint.c b/src/H5Rint.c index 486c1ff..131336b 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1768,6 +1768,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, H5O_token_t token = { 0 }; size_t data_size; const uint8_t *p; + H5S_t *space = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -1788,7 +1789,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, if(space_ptr) { H5O_loc_t oloc; /* Object location */ - H5S_t *space = NULL; /* Initialize the object location */ H5O_loc_reset(&oloc); @@ -1812,6 +1812,12 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, done: H5MM_free(data); + + if(ret_value < 0) { + if(space && H5S_close(space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + } + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_region_compat() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 4a4245d..77fb582 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -690,6 +690,9 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p) /* 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") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Snone.c b/src/H5Snone.c index 0949b2a..630d1d5 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -648,6 +648,9 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(*p, version); + if(version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index e139bce..da2dd4a 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -47,14 +47,17 @@ #define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ -#define H5S_POINT_VERSION_1 1 -#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_1 1 +#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_2 /* Versions for H5S_SEL_NONE selection info */ -#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_LATEST H5S_NONE_VERSION_1 /* Versions for H5S_SEL_ALL selection info */ -#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1 /* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */ #define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 5e2bc8b..8259275 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1412,6 +1412,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection") + if(version >= (uint32_t)H5S_POINT_VERSION_2) /* Decode size of point info */ enc_size = *(pp)++; |