summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-04-17 20:22:12 (GMT)
committerGitHub <noreply@github.com>2023-04-17 20:22:12 (GMT)
commit413a1e590830b1e00d58707cc5f757be0367e2f9 (patch)
tree1b34741cd7d54403bc81276b59254cb3dad3b98b /src
parentad808ec66aceb9f16fee55a3aa93007e282b300d (diff)
downloadhdf5-413a1e590830b1e00d58707cc5f757be0367e2f9.zip
hdf5-413a1e590830b1e00d58707cc5f757be0367e2f9.tar.gz
hdf5-413a1e590830b1e00d58707cc5f757be0367e2f9.tar.bz2
Check for invalid AAPL in H5Aopen (#2712)
Diffstat (limited to 'src')
-rw-r--r--src/H5VLnative_attr.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index b7e9b13..d83b6bd 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -135,12 +135,13 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name,
- hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5G_loc_t loc; /* Object location */
- H5A_t *attr = NULL; /* Attribute opened */
- void *ret_value;
+ H5P_genplist_t *plist;
+ H5G_loc_t loc; /* Object location */
+ H5A_t *attr = NULL; /* Attribute opened */
+ void *ret_value;
FUNC_ENTER_PACKAGE
@@ -148,6 +149,9 @@ H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const cha
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
+ if (NULL == (plist = H5P_object_verify(aapl_id, H5P_ATTRIBUTE_ACCESS)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "AAPL is not an attribute access property list")
+
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
/* H5Aopen */
/* Open the attribute */