summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylu-hdf <60487644+raylu-hdf@users.noreply.github.com>2023-02-17 22:15:48 (GMT)
committerGitHub <noreply@github.com>2023-02-17 22:15:48 (GMT)
commit0cc028a36c47b3ba75db3a15e5196f08e8094c72 (patch)
tree1aee163673b2a955b62bebb2133c253ae393f5f2
parent966454aac1231da7209ef81c11055d3312181f99 (diff)
downloadhdf5-0cc028a36c47b3ba75db3a15e5196f08e8094c72.zip
hdf5-0cc028a36c47b3ba75db3a15e5196f08e8094c72.tar.gz
hdf5-0cc028a36c47b3ba75db3a15e5196f08e8094c72.tar.bz2
GitHub #2417: to avoid the pass-through VOL failing in unexpected places, make sure the underneath VOL ID is specified. (#2475)
* GitHub #2417: to avoid the pass-through VOL failing in unexpected places, make sure the underneath VOL ID is specified. * Committing clang-format changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r--src/H5VLpassthru.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index d7e730a..4ceac7a 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -388,6 +388,7 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t));
new_obj->under_object = under_obj;
new_obj->under_vol_id = under_vol_id;
+
H5Iinc_ref(new_obj->under_vol_id);
return new_obj;
@@ -520,12 +521,27 @@ H5VL_pass_through_info_copy(const void *_info)
printf("------- PASS THROUGH VOL INFO Copy\n");
#endif
+ /* Make sure the underneath VOL of this pass-through VOL is specified */
+ if (!info) {
+ printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__,
+ __func__);
+ return NULL;
+ }
+
+ if (H5Iis_valid(info->under_vol_id) <= 0) {
+ printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n",
+ __LINE__, __func__);
+ return NULL;
+ }
+
/* Allocate new VOL info struct for the pass through connector */
new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
/* Increment reference count on underlying VOL ID, and copy the VOL info */
new_info->under_vol_id = info->under_vol_id;
+
H5Iinc_ref(new_info->under_vol_id);
+
if (info->under_vol_info)
H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info);
@@ -753,7 +769,9 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
/* Increment reference count on underlying VOL ID, and copy the VOL info */
new_wrap_ctx->under_vol_id = o->under_vol_id;
+
H5Iinc_ref(new_wrap_ctx->under_vol_id);
+
H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx);
/* Set wrap context to return */
@@ -2605,6 +2623,19 @@ H5VL_pass_through_introspect_get_cap_flags(const void *_info, uint64_t *cap_flag
printf("------- PASS THROUGH VOL INTROSPECT GetCapFlags\n");
#endif
+ /* Make sure the underneath VOL of this pass-through VOL is specified */
+ if (!info) {
+ printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__,
+ __func__);
+ return -1;
+ }
+
+ if (H5Iis_valid(info->under_vol_id) <= 0) {
+ printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n",
+ __LINE__, __func__);
+ return -1;
+ }
+
/* Invoke the query on the underlying VOL connector */
ret_value = H5VLintrospect_get_cap_flags(info->under_vol_info, info->under_vol_id, cap_flags);