summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorraylu-hdf <60487644+raylu-hdf@users.noreply.github.com>2022-08-05 16:05:07 (GMT)
committerGitHub <noreply@github.com>2022-08-05 16:05:07 (GMT)
commit54f116b42db2d2aabd6fdb58cebb99f04f106310 (patch)
tree08509670b3bb1494e27266412701397c5fea2353 /src/H5G.c
parentbf07e0f2c9b381509abbde59fca8bea5445da261 (diff)
downloadhdf5-54f116b42db2d2aabd6fdb58cebb99f04f106310.zip
hdf5-54f116b42db2d2aabd6fdb58cebb99f04f106310.tar.gz
hdf5-54f116b42db2d2aabd6fdb58cebb99f04f106310.tar.bz2
Sanity checks for H5Xcreate_anon functions to make sure the IDs passed in are valid (#1967)
* Sanity checks for H5Xcreate_anon functions to make sure the IDs passed in are valid. * Removed unnecessary sanity checks. Co-authored-by: songyulu <songyulu@jelly.ad.hdfgroup.org>
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 07e9057..b570979 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -325,12 +325,17 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id);
- /* Check group creation property list */
+ /* Check group property list */
if (H5P_DEFAULT == gcpl_id)
gcpl_id = H5P_GROUP_CREATE_DEFAULT;
else if (TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list")
+ if (H5P_DEFAULT == gapl_id)
+ gapl_id = H5P_GROUP_ACCESS_DEFAULT;
+ else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list")
+
/* Verify access property list and set up collective metadata if appropriate */
if (H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")