Explicitly ignore HDF5 object references when reading types

This commit is contained in:
Peter Hill 2023-03-10 10:19:42 +00:00
parent 8589214b93
commit 03f3eb3ce1
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE

View File

@ -242,9 +242,10 @@ get_type_info2(NC_GRP_INFO_T *h5_grp, hid_t datasetid, NC_TYPE_INFO_T **type_inf
/* If we didn't find the type, then it's probably a transient
* type, stored in the dataset itself, so let's read it now */
if (type == NULL) {
int retval;
if ((retval = read_type(h5_grp, native_typeid, "")))
return retval;
/* If we still can't read the type, ignore it, it probably
* means this object is a reference */
if (read_type(h5_grp, native_typeid, ""))
return NC_EBADTYPID;
if((type = nc4_rec_find_hdf_type(h5, native_typeid)))
*type_info = type;
@ -2064,6 +2065,14 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name)
LOG((4, "%s: type_name %s grp->hdr.name %s", __func__, type_name,
grp->hdr.name));
/* What is the class of this type, compound, vlen, etc. */
if ((class = H5Tget_class(hdf_typeid)) < 0)
return NC_EHDFERR;
/* Explicitly don't handle reference types */
if (class == H5T_REFERENCE)
return NC_EBADCLASS;
/* What is the native type for this platform? */
if ((native_typeid = H5Tget_native_type(hdf_typeid, H5T_DIR_DEFAULT)) < 0)
return NC_EHDFERR;
@ -2093,9 +2102,6 @@ read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char *type_name)
if (H5Iinc_ref(hdf5_type->hdf_typeid) < 0)
return NC_EHDFERR;
/* What is the class of this type, compound, vlen, etc. */
if ((class = H5Tget_class(hdf_typeid)) < 0)
return NC_EHDFERR;
switch (class)
{
case H5T_STRING: