diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-04-11 19:47:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 19:47:51 (GMT) |
commit | bc8fa3a477e46d1fd3661666e4de79f455d41e19 (patch) | |
tree | 02d5d002ac562c328a112505543c29386775f248 /src/H5private.h | |
parent | 2e7d8f7ed52aa58a245e2ce2509a94f5a8162506 (diff) | |
download | hdf5-bc8fa3a477e46d1fd3661666e4de79f455d41e19.zip hdf5-bc8fa3a477e46d1fd3661666e4de79f455d41e19.tar.gz hdf5-bc8fa3a477e46d1fd3661666e4de79f455d41e19.tar.bz2 |
Add buffer overrun checks to H5O__layout_decode and H5O__sdspace_decode (#2679)
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/H5private.h b/src/H5private.h index ec77bbb..eb7d8e0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -325,6 +325,11 @@ /* Raise an integer to a power of 2 */ #define H5_EXP2(n) (1 << (n)) +/* Check if a read of size bytes starting at ptr would overflow past + * the last valid byte, pointed to by buffer_end. + */ +#define H5_IS_BUFFER_OVERFLOW(ptr, size, buffer_end) (((ptr) + (size)-1) > (buffer_end)) + /* * HDF Boolean type. */ |