diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-12-21 00:50:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 00:50:01 (GMT) |
commit | 777d9fc570f739e37e535f9d4ff35b8d9499f0e4 (patch) | |
tree | 838b96512108fdd7e891dd0dec95c14922520ed7 /test/tmisc.c | |
parent | 35b6449c22edfad2af3b70094802215e4455b6e4 (diff) | |
download | hdf5-777d9fc570f739e37e535f9d4ff35b8d9499f0e4.zip hdf5-777d9fc570f739e37e535f9d4ff35b8d9499f0e4.tar.gz hdf5-777d9fc570f739e37e535f9d4ff35b8d9499f0e4.tar.bz2 |
1.14.0: Brings the following changesets over from develop: (#2330)
* Brings the following changesets over from develop:
b9244a85d9f1cc5e9bbec61ca73c0cbd9c4cf249 Align arg types of H5D_chunk_iter_op_t with H5Dget_chunk_info (#2074)
70cf2c390bc2eef8e57f8fa023341011e2d02d9d Removed idioms and misc. text clean-up (#2320)
8102fa8c972bdc0d8fd8f3dae604e070893150d6 Only document Fortran functions (#2319)
784061b15e176b9919c19a220ce278a9f4cddf0e moved onion VFD to FAPL group (#2321)
6b6bcdead66f0456ac0528683faac6a8e48b6565 Hdffv 11052 (#2315)
10c693a04ff0c4a5219879d7f8900157dcbece66 Update hdf5_header.html
0cb58080875070db09b5ecae92482519d58872bc Hdffv 11052 (#2303)
a1c81eda203addced514ef655f7a9079f3f0bb04 added doc. warning for H5Literate_async return value (#2295)
502b32b0f22a4bcf6333c85c256db34162c2764a Updated H5ES documenation (#2293)
a9036005c3916e6fda0296026323f00d043300f8 Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC)… (#2291)
* Brings the following changes over from develop:
c1e44d32e616518e0626bdfe042bed0052846fef Fix doxygen warnings and remove javadocs (#2324)
149b8e9769887c5b23400b526dc10463f88f2c3e Disable hl tools by default (#2313)
Diffstat (limited to 'test/tmisc.c')
-rw-r--r-- | test/tmisc.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/tmisc.c b/test/tmisc.c index 5cad368..5fb44d4 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -330,6 +330,11 @@ typedef struct { #define MISC35_SPACE_DIM3 13 #define MISC35_NPOINTS 10 +/* Definitions for misc. test #37 */ +/* The test file is formerly named h5_nrefs_POC. + See https://nvd.nist.gov/vuln/detail/CVE-2020-10812 */ +#define CVE_2020_10812_FILENAME "cve_2020_10812.h5" + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -6046,6 +6051,47 @@ test_misc36(void) /**************************************************************** ** +** test_misc37(): +** Test for seg fault issue when closing the provided test file +** which has an illegal file size in its cache image. +** See HDFFV-11052/CVE-2020-10812 for details. +** +****************************************************************/ +static void +test_misc37(void) +{ + const char *testfile = H5_get_srcdir_filename(CVE_2020_10812_FILENAME); + hbool_t driver_is_default_compatible; + hid_t fid; + herr_t ret; + + /* Output message about test being performed */ + MESSAGE(5, ("Fix for HDFFV-11052/CVE-2020-10812")); + + ret = h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible); + CHECK(ret, FAIL, "h5_driver_is_default_vfd_compatible"); + + if (!driver_is_default_compatible) { + HDprintf("-- SKIPPED --\n"); + return; + } + + fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* This should fail due to the illegal file size. + It should fail gracefully and not seg fault */ + H5E_BEGIN_TRY + { + ret = H5Fclose(fid); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Fclose"); + +} /* end test_misc37() */ + +/**************************************************************** +** ** test_misc(): Main misc. test routine. ** ****************************************************************/ @@ -6111,6 +6157,7 @@ test_misc(void) test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ + test_misc37(); /* Test for seg fault failure at file close */ } /* test_misc() */ |