diff options
author | Neil Fortner <fortnern@gmail.com> | 2022-09-01 13:19:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 13:19:01 (GMT) |
commit | 033b7ace5aff35cced7561921789176fb3831cdb (patch) | |
tree | 5c6dc926bd60a317aab702297f64cb8a06b9e0cc /src | |
parent | 3cc7265e7727534eafbb2261768edfc0b6b3db82 (diff) | |
download | hdf5-033b7ace5aff35cced7561921789176fb3831cdb.zip hdf5-033b7ace5aff35cced7561921789176fb3831cdb.tar.gz hdf5-033b7ace5aff35cced7561921789176fb3831cdb.tar.bz2 |
Address review comments from downstream merge of #2016 (#2073) (#2081)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Aint.c | 8 |
1 files changed, 5 insertions, 3 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. */ |