summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2024-03-13 12:35:04 (GMT)
committerGitHub <noreply@github.com>2024-03-13 12:35:04 (GMT)
commit5b7be284bc3a29f3d1b50857f7908f487210212d (patch)
tree612eef5ed54de717b50c5495df10471d01ca67f7 /src
parent7741170bdd225da130f3ab98c454c118b5511b14 (diff)
downloadhdf5-5b7be284bc3a29f3d1b50857f7908f487210212d.zip
hdf5-5b7be284bc3a29f3d1b50857f7908f487210212d.tar.gz
hdf5-5b7be284bc3a29f3d1b50857f7908f487210212d.tar.bz2
Sync develop branch changes March 4 - 6 to hdf5_1_14 branch (#4121)
* Do not enable szip for sanitizer runs (#4057) * Add note to H5Tset_fields about needing to set datatype precision first (#4059) * Offset of a floating-point type also needs to be accounted for * Clarify ordering of H5Tset_precision and H5Tset_fields * Fix issue where H5Tset_fields does not account for datatype offsets (#4061) H5Tset_fields did not account for any offset in a floating-point datatype, causing it to fail when a datatype's precision is correctly set such that it doesn't include the offset bits. * Ignore UserPresets and Use only C compiler for sanitizers (#4066) * Remove user presets file * Only use C compiler for sanitzers * Rename incorrectly named option (#4067) * Rename incorrectly named option * Restore the correct uses of USING_MEMCHECKER * Update release note * Fix a memory leak in the cmpd_dset test (#4071) This was due to not freeing a test buffer. It was not a core library memory leak. * Fix uninitialized bytes in cmpd_dset test (#4072) Compound fill values were set to the integer -1, causing valgrind to flag 'uninitialized bytes' errors. This is just a problem with the cmpd_dset test and not a core library problem. * Update INSTALL files (#4052) * Add NEWSLETTER and merge abi reports and add sha256sums (#4055) * Fix uninitialized bytes in selection I/O test (#4073) This was due to a complex type fill value being set to -1 instead of a proper complex value. This was a test problem and not a core library issue. * fix path for S3 build path in CI (#4076) * Correct paths for 1.14 and add lines missing from release_docs/INSTALL_CMake.txt. --------- Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5Tfloat.c6
-rw-r--r--src/H5Tpublic.h11
2 files changed, 14 insertions, 3 deletions
diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c
index 01a5607..9f7b4f7 100644
--- a/src/H5Tfloat.c
+++ b/src/H5Tfloat.c
@@ -106,11 +106,11 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, size_t mpos
dt = dt->shared->parent; /*defer to parent*/
if (H5T_FLOAT != dt->shared->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class");
- if (epos + esize > dt->shared->u.atomic.prec)
+ if (epos + esize - dt->shared->u.atomic.offset > dt->shared->u.atomic.prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid");
- if (mpos + msize > dt->shared->u.atomic.prec)
+ if (mpos + msize - dt->shared->u.atomic.offset > dt->shared->u.atomic.prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid");
- if (spos >= dt->shared->u.atomic.prec)
+ if (spos - dt->shared->u.atomic.offset >= dt->shared->u.atomic.prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid");
/* Check for overlap */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index a117075..abf64d9 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -2568,6 +2568,17 @@ H5_DLL herr_t H5Tset_sign(hid_t type_id, H5T_sign_t sign);
* Fields are not allowed to extend beyond the number of bits of
* precision, nor are they allowed to overlap with one another.
*
+ * \note The size and precision of, as well as any offset for, a floating-point
+ * datatype should generally be set appropriately before calling
+ * H5Tset_fields(). Otherwise, H5Tset_fields() may fail when checking that
+ * the values make sense for the datatype. However, if the precision of a
+ * floating-point datatype will be decreased during its creation with a call
+ * to H5Tset_precision(), then H5Tset_fields() should instead be called
+ * first to set appropriate values for \p spos, \p epos, \p esize, \p mpos
+ * and \p msize before reducing the precision of the datatype with
+ * H5Tset_precision(). This is of particular concern if another floating-point
+ * datatype was copied as a starting point.
+ *
* \since 1.0.0
*
*/