summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2017-08-24 19:37:13 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2017-08-24 19:37:13 (GMT)
commite04817b5aa097f7e98e3552c854d7d0a05708f3e (patch)
treed8f485854202a89b7bf0ff9d49ae5f7c8fec6870 /test/tmisc.c
parent1cf7c7ecc90b408fed818b00153a2d36295da801 (diff)
parent593e4038b3ab474a47e468bb3478d4ae3a6820e6 (diff)
downloadhdf5-e04817b5aa097f7e98e3552c854d7d0a05708f3e.zip
hdf5-e04817b5aa097f7e98e3552c854d7d0a05708f3e.tar.gz
hdf5-e04817b5aa097f7e98e3552c854d7d0a05708f3e.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '593e4038b3ab474a47e468bb3478d4ae3a6820e6': Fix for daily test failure Fix for the compilation error from the PGI compiler. Modifications based on comments from pull request review (1) Remove unnecessary asserts (2) Add code to insert bad offset values to the test file in gen_bad_offset.c HDFFV-10188 force non-native type description HDFFV-10188 emu insists on printing non-native description Fix for HDFFV-10216 segfault in H5G_node_cmp3 with corrupt h5 file Fix H5HL_offset_into() to return error when offset exceeds heap data block size. Also fix other places that call this routine to detect error return. HDFFV-10188 fix typo HDFFV-10188 add missing copy commands HDFFV-10188 Add tests and files HDFFV-10188 enable null space test HDFFV-10188 add release note HDFFV-10188 - Check for empty string first HDFFV-10188 error on NULL dataspace
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index 708ca9b..102325a 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -318,6 +318,11 @@ typedef struct
#define MISC31_PROPNAME "misc31_prop"
#define MISC31_DTYPENAME "dtype"
+/* Definitions for misc. test #33 */
+/* Note that this test file is generated by "gen_bad_offset.c" */
+/* and bad offset values are written to that file for testing */
+#define MISC33_FILE "bad_offset.h5"
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -5472,6 +5477,55 @@ test_misc32(void)
} /* end test_misc32() */
+/****************************************************************
+**
+** test_misc33(): Test for H5FFV-10216
+** --verify that H5HL_offset_into() returns error if the
+** input parameter "offset" exceeds heap data block size.
+** --case (1), (2), (3) are scenarios that will traverse to the
+** the 3 locations in the file having bad offset values to
+** the heap. (See description in gen_bad_offset.c)
+**
+****************************************************************/
+static void
+test_misc33(void)
+{
+ hid_t fid = -1; /* File ID */
+ const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */
+ H5O_info_t oinfo; /* Structure for object metadata information */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing that bad offset into the heap returns error"));
+
+ /* Open the test file */
+ fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Case (1) */
+ H5E_BEGIN_TRY {
+ ret = H5Oget_info_by_name(fid, "/soft_two", &oinfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Case (2) */
+ H5E_BEGIN_TRY {
+ ret = H5Oget_info_by_name(fid, "/dsetA", &oinfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Case (3) */
+ H5E_BEGIN_TRY {
+ ret = H5Oget_info_by_name(fid, "/soft_one", &oinfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(fid, FAIL, "H5Fclose");
+
+} /* end test_misc33() */
+
/****************************************************************
**
@@ -5520,6 +5574,7 @@ test_misc(void)
test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */
test_misc31(); /* Test Reentering library through deprecated routines after H5close() */
test_misc32(); /* Test filter memory allocation functions */
+ test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */
} /* test_misc() */