summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authormattjala <124107509+mattjala@users.noreply.github.com>2023-05-18 16:13:34 (GMT)
committerGitHub <noreply@github.com>2023-05-18 16:13:34 (GMT)
commit8dcc7dc17ff4e797edc5570a6eaa1d8da691b97e (patch)
tree53b1f43c643978533a0e679aa07a8169f4367ee0 /src/H5private.h
parentd5143567c8f08f6f6de80ffcffa3ede98634ca78 (diff)
downloadhdf5-8dcc7dc17ff4e797edc5570a6eaa1d8da691b97e.zip
hdf5-8dcc7dc17ff4e797edc5570a6eaa1d8da691b97e.tar.gz
hdf5-8dcc7dc17ff4e797edc5570a6eaa1d8da691b97e.tar.bz2
Prevent buffer overrun in H5S_select_deserialize (#2956)
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 7d15312..36a40ad 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -403,6 +403,15 @@
*/
#define H5_IS_BUFFER_OVERFLOW(ptr, size, buffer_end) (((ptr) + (size)-1) > (buffer_end))
+/* Variant of H5_IS_BUFFER_OVERFLOW, used with functions such as H5Tdecode()
+ * that don't take a size parameter, where we need to skip the bounds checks.
+ *
+ * This is a separate macro since we don't want to inflict that behavior on
+ * the entire library.
+ */
+#define H5_IS_KNOWN_BUFFER_OVERFLOW(skip, ptr, size, buffer_end) \
+ (skip ? FALSE : ((ptr) + (size)-1) > (buffer_end))
+
/*
* HDF Boolean type.
*/