summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authormattjala <124107509+mattjala@users.noreply.github.com>2023-11-22 13:55:25 (GMT)
committerGitHub <noreply@github.com>2023-11-22 13:55:25 (GMT)
commitaf4c6c4f1579802f00fa5ef24c35ce4086d78591 (patch)
tree6d8e64407f9285479caae7f60e343787691a0d00 /src/H5T.c
parent3ea21ccb3e84dae935c32faff5d10ce9672a3265 (diff)
downloadhdf5-af4c6c4f1579802f00fa5ef24c35ce4086d78591.zip
hdf5-af4c6c4f1579802f00fa5ef24c35ce4086d78591.tar.gz
hdf5-af4c6c4f1579802f00fa5ef24c35ce4086d78591.tar.bz2
Fix segfault on user compound dtype conversion callback (#3842)
* Fix segfault on user compound conversion * Check if lib conversion func is in use
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/H5T.c b/src/H5T.c
index a02abfc..8494680 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5174,10 +5174,10 @@ H5T_path_noop(const H5T_path_t *p)
/*-------------------------------------------------------------------------
* Function: H5T_path_compound_subset
*
- * Purpose: Checks if the source and destination types are both compound.
- * Tells whether whether the source members are a subset of
- * destination, and the order is the same, and no conversion
- * is needed. For example:
+ * Purpose: Checks if the library's compound conversion function
+ * is in use. Tells whether whether the source members are
+ * a subset of destination, and the order is the same, and
+ * no conversion is needed. For example:
* struct source { struct destination {
* TYPE1 A; --> TYPE1 A;
* TYPE2 B; --> TYPE2 B;
@@ -5186,8 +5186,9 @@ H5T_path_noop(const H5T_path_t *p)
* TYPE5 E;
* };
*
- * Return: A pointer to the subset info struct in p, or NULL if there are
- * no compounds. Points directly into the H5T_path_t structure.
+ * Return: A pointer to the subset info struct in p, or NULL if the
+ * library's compound conversion function is not in use.
+ * Points directly into the H5T_path_t structure.
*
*-------------------------------------------------------------------------
*/
@@ -5200,7 +5201,9 @@ H5T_path_compound_subset(const H5T_path_t *p)
assert(p);
- if (p->are_compounds)
+ /* Only retrieve private info if the library compound conversion
+ * function is in use */
+ if (!p->conv.is_app && (p->conv.u.lib_func == H5T__conv_struct))
ret_value = H5T__conv_struct_subset(&(p->cdata));
FUNC_LEAVE_NOAPI(ret_value)