summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-11-24 22:20:13 (GMT)
committerGitHub <noreply@github.com>2021-11-24 22:20:13 (GMT)
commitca6f9e3716bd1a35624167986b836d2f7674bcd1 (patch)
treefd1758681d3b25b5d5aa6a4b2dc55639c628a052 /src
parent5c061219767cb3d5d387bae188f63756d75424aa (diff)
downloadhdf5-ca6f9e3716bd1a35624167986b836d2f7674bcd1.zip
hdf5-ca6f9e3716bd1a35624167986b836d2f7674bcd1.tar.gz
hdf5-ca6f9e3716bd1a35624167986b836d2f7674bcd1.tar.bz2
Fixes an assert in H5Pget_filter_by_id1/2 w/ out-of-range IDs (#1222)
* Fixes an assert in H5Pget_filter_by_id1/2 w/ out-of-range IDs Filter IDs < 0 or > H5Z_FILTER_MAX could trip an assert in the library due to missing ID range checks in H5Pget_filter_by_id1/2. The library now returns a normal error code when filter IDs are out of range. Fixes HDFFV-11286. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5Pocpl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index edb0cca..e442030 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -940,6 +940,8 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
@@ -1838,6 +1840,8 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so