diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2020-06-22 03:48:21 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2020-06-22 03:48:21 (GMT) |
commit | a08ab621febde7b09e4d86eab80cb029c123e9f6 (patch) | |
tree | caa0109e0554b903a77ec73b5632e27d6f5985fb /src | |
parent | 6ffe9af32f6e926e4f4006d42ad0813d7f0b8f34 (diff) | |
parent | 7d58d115079d286a566207c529e59bbccc952b03 (diff) | |
download | hdf5-a08ab621febde7b09e4d86eab80cb029c123e9f6.zip hdf5-a08ab621febde7b09e4d86eab80cb029c123e9f6.tar.gz hdf5-a08ab621febde7b09e4d86eab80cb029c123e9f6.tar.bz2 |
Merge pull request #2654 in HDFFV/hdf5 from bmr_HDFFV-10591 to develop
Fixed HDFFV-10591
* commit '7d58d115079d286a566207c529e59bbccc952b03':
Added note for HDFFV-10591.
Fix HDFFV-10591
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Oattr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c index aeaebea..e38ef5c 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -238,6 +238,11 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, /* Go get the data */ if(attr->shared->data_size) { + /* Ensure that data size doesn't exceed buffer size, in case of + it's being corrupted in the file */ + if(attr->shared->data_size > p_size) + HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds buffer size") + if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5MM_memcpy(attr->shared->data, p, attr->shared->data_size); |