summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com>2024-02-06 20:59:27 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2024-02-14 22:05:22 (GMT)
commit5153821799958d142e6625a97e4ac1de0a777b0c (patch)
treea8662077dc84a090b674e002464325b4c1195f0f
parentfbe0c87a79746ed30de4738f29c1183898f19c50 (diff)
downloadhdf5-5153821799958d142e6625a97e4ac1de0a777b0c.zip
hdf5-5153821799958d142e6625a97e4ac1de0a777b0c.tar.gz
hdf5-5153821799958d142e6625a97e4ac1de0a777b0c.tar.bz2
Fix for github issue #2414: segfault when copying dataset with attrib… (#3967)
* Fix for github issue #2414: segfault when copying dataset with attributes. This also fixes github issue #3241: segfault when copying dataset. Need to set the location via H5T_set_loc() of the src datatype when copying dense attributes. Otherwise the vlen callbacks are not set up therefore causing seg fault when doing H5T_convert() -> H5T__conv_vlen().
-rw-r--r--src/H5Aint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index c272402..0cbe462 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -2455,6 +2455,10 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
assert(udata->file);
assert(udata->cpy_info);
+ /* Set the location of the src datatype */
+ if (H5T_set_loc(attr_src->shared->dt, H5F_VOL_OBJ(udata->oloc_src->file), H5T_LOC_DISK) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "cannot mark datatype on disk");
+
if (NULL ==
(attr_dst = H5A__attr_copy_file(attr_src, udata->file, udata->recompute_size, udata->cpy_info)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute");
@@ -2464,7 +2468,7 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
/* Reset shared location information */
if (H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, H5_ITER_ERROR, "unable to reset attribute sharing");
/* Set COPIED tag for destination object's metadata */
H5_BEGIN_TAG(H5AC__COPIED_TAG)
@@ -2478,7 +2482,7 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
done:
if (attr_dst && H5A__close(attr_dst) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute");
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close destination attribute");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_post_copy_file_cb() */