summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2021-05-26 17:05:24 (GMT)
committerGitHub <noreply@github.com>2021-05-26 17:05:24 (GMT)
commitee9d6f514ac163e4739440ab4b0ec70d59a0f7ce (patch)
tree6fad68bc02d8329a1c7caf687c7e6208ff93dd74 /test
parent2c5d08d84d40ca7b8063e85e7db51024686ea28f (diff)
downloadhdf5-ee9d6f514ac163e4739440ab4b0ec70d59a0f7ce.zip
hdf5-ee9d6f514ac163e4739440ab4b0ec70d59a0f7ce.tar.gz
hdf5-ee9d6f514ac163e4739440ab4b0ec70d59a0f7ce.tar.bz2
Use internal version of H5Eprint2 to avoid possible stack overflow (#661)
Diffstat (limited to 'test')
-rw-r--r--test/err_compat.c16
-rw-r--r--test/error_test.c2
2 files changed, 8 insertions, 10 deletions
diff --git a/test/err_compat.c b/test/err_compat.c
index 6f3cfb3..6ad69d8 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -228,16 +228,14 @@ test_error_compat(void)
if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- /* Use H5Eget_auto2 to query the default printing function. The library
- *should indicate H5Eprint2 as the default. */
+ /* Use H5Eget_auto2 to query the default printing function. */
if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data) < 0)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
- if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
+ if (old_func2 == NULL)
TEST_ERROR;
- /* This function sets the default printing function to be H5Eprint2. */
if (H5Eset_auto2(H5E_DEFAULT, old_func2, old_data) < 0)
TEST_ERROR;
@@ -282,12 +280,12 @@ test_error_compat(void)
if (did >= 0)
TEST_ERROR;
- /* This function changes the new-style printing function back to the default H5Eprint2. */
- if (H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL) < 0)
+ /* This function changes the new-style printing function to the original. */
+ if (H5Eset_auto2(H5E_DEFAULT, old_func2, NULL) < 0)
TEST_ERROR;
- /* This call should work because the H5Eset_auto2 above restored the default printing
- * function H5Eprint2. It simply returns user_print1. */
+ /* This call should work because the H5Eset_auto2 above set the default printing
+ * function to H5Eprint2. It simply returns user_print1. */
if ((ret = H5Eget_auto1(&old_func1, &old_data)) < 0)
TEST_ERROR;
if (old_data != NULL)
@@ -305,7 +303,7 @@ test_error_compat(void)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
- if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2)
+ if (old_func2 == NULL)
TEST_ERROR;
/* Try the printing function. Dataset creation should fail because the file
diff --git a/test/error_test.c b/test/error_test.c
index d1ce00b..cf1e82c 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -129,7 +129,7 @@ test_error(hid_t file)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
- if (old_func != (H5E_auto2_t)H5Eprint2)
+ if (old_func == NULL)
TEST_ERROR;
if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)