summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-04-18 02:09:44 (GMT)
committerGitHub <noreply@github.com>2023-04-18 02:09:44 (GMT)
commit1ffe6afce83b18ec608827089a080ef671a27e8f (patch)
treeb60df4a9574af3a33c84a071c46862e6cd51244f
parent5fcffd1eb197d18bba6618cca357313f4113b149 (diff)
downloadhdf5-1ffe6afce83b18ec608827089a080ef671a27e8f.zip
hdf5-1ffe6afce83b18ec608827089a080ef671a27e8f.tar.gz
hdf5-1ffe6afce83b18ec608827089a080ef671a27e8f.tar.bz2
Check for invalid AAPL in H5Aopen (#2712) (#2771)
-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 c6099da..65241b2 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -104,12 +104,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
@@ -117,6 +118,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 */