summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <fortnern@gmail.com>2022-09-01 13:19:01 (GMT)
committerGitHub <noreply@github.com>2022-09-01 13:19:01 (GMT)
commit033b7ace5aff35cced7561921789176fb3831cdb (patch)
tree5c6dc926bd60a317aab702297f64cb8a06b9e0cc
parent3cc7265e7727534eafbb2261768edfc0b6b3db82 (diff)
downloadhdf5-033b7ace5aff35cced7561921789176fb3831cdb.zip
hdf5-033b7ace5aff35cced7561921789176fb3831cdb.tar.gz
hdf5-033b7ace5aff35cced7561921789176fb3831cdb.tar.bz2
Address review comments from downstream merge of #2016 (#2073) (#2081)
-rw-r--r--src/H5Aint.c8
-rw-r--r--test/dtypes.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 876bfa2..0bb9576 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -647,11 +647,13 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
if (need_bkg) {
/* Allocate background buffer */
if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
- HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Copy the application buffer into the background buffer if necessary */
- if (need_bkg == H5T_BKG_YES)
- H5MM_memcpy(bkg_buf, buf, (dst_type_size * nelmts));
+ if (need_bkg == H5T_BKG_YES) {
+ HDassert(buf_size >= (dst_type_size * nelmts));
+ H5MM_memcpy(bkg_buf, buf, dst_type_size * nelmts);
+ }
}
/* Perform datatype conversion. */
diff --git a/test/dtypes.c b/test/dtypes.c
index c72fce0..75a8f6e 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -3432,7 +3432,7 @@ test_compound_15_attr(void)
if ((attr_id = H5Acreate_by_name(file, ".", "attr_cmpd", cmpd_f_tid, space_id, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0)
- FAIL_PUTS_ERROR("Can't create dataset\n");
+ FAIL_PUTS_ERROR("Can't create attribute\n");
if (H5Awrite(attr_id, cmpd_f_tid, &wdata1) < 0)
FAIL_PUTS_ERROR("Can't write data\n");