summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-04-11 19:47:51 (GMT)
committerGitHub <noreply@github.com>2023-04-11 19:47:51 (GMT)
commitbc8fa3a477e46d1fd3661666e4de79f455d41e19 (patch)
tree02d5d002ac562c328a112505543c29386775f248 /src/H5private.h
parent2e7d8f7ed52aa58a245e2ce2509a94f5a8162506 (diff)
downloadhdf5-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.h5
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.
*/