summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <fortnern@gmail.com>2022-08-31 16:01:05 (GMT)
committerGitHub <noreply@github.com>2022-08-31 16:01:05 (GMT)
commit5de9d63ff433f146b29d7331c07ac6fae9a98a5e (patch)
tree8ed5dfe346e7c6ce78edb982811409a40e5a6584 /src
parent5719187a34f8b72cafe846db434569dadf0f33f2 (diff)
downloadhdf5-5de9d63ff433f146b29d7331c07ac6fae9a98a5e.zip
hdf5-5de9d63ff433f146b29d7331c07ac6fae9a98a5e.tar.gz
hdf5-5de9d63ff433f146b29d7331c07ac6fae9a98a5e.tar.bz2
Address review comments from downstream merge of #2016 (#2073)
Diffstat (limited to 'src')
-rw-r--r--src/H5Aint.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 4403da8..e6440bb 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -761,11 +761,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. */