mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
Merge pull request #1610 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_fixbug:develop to develop
* commit 'fe104cc38ffbdb39d3e04da107d86ebfc7e8b622': Test improvement Description Moved the new tests to a more appropriate test function. Platforms tested: Linux/64 (jelly) Fixed HDFFV-10210 and HDFFV-10587 Description: - Added parameter validation (HDFFV-10210) - Added detection of division by zero (HDFFV-10587 - CVE-2018-17438) - Fixed typos in various tests Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test)
This commit is contained in:
commit
d818edb110
@ -609,10 +609,10 @@ static void test_getobjectinfo_same_file()
|
||||
catch (Exception& E)
|
||||
{
|
||||
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
|
||||
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
|
||||
issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg());
|
||||
}
|
||||
|
||||
} // test_h5o_getinfo_same_file
|
||||
} // test_getobjectinfo_same_file
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_object
|
||||
|
@ -227,6 +227,8 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
|
||||
|
||||
/* Decrement number of elements left to process */
|
||||
HDassert(((size_t)tmp_file_len % elmt_size) == 0);
|
||||
if(elmt_size == 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "Resulted in division by zero")
|
||||
nelmts -= ((size_t)tmp_file_len / elmt_size);
|
||||
} /* end while */
|
||||
} /* end else */
|
||||
|
@ -355,6 +355,9 @@ H5Itype_exists(H5I_type_t type)
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE1("t", "It", type);
|
||||
|
||||
if(H5I_IS_LIB_TYPE(type))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type")
|
||||
|
||||
if (type <= H5I_BADID || type >= H5I_next_type)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
|
||||
|
||||
|
28
test/tid.c
28
test/tid.c
@ -251,7 +251,10 @@ static int id_predefined_test(void )
|
||||
|
||||
testObj = HDmalloc(sizeof(int));
|
||||
|
||||
/* Try to perform illegal functions on various predefined types */
|
||||
/*
|
||||
* Attempt to perform public functions on various library types
|
||||
*/
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
testID = H5Iregister(H5I_FILE, testObj);
|
||||
H5E_END_TRY
|
||||
@ -292,7 +295,26 @@ static int id_predefined_test(void )
|
||||
if(testErr >= 0)
|
||||
goto out;
|
||||
|
||||
/* Create a datatype ID and try to perform illegal functions on it */
|
||||
H5E_BEGIN_TRY
|
||||
testErr = H5Itype_exists(H5I_GROUP);
|
||||
H5E_END_TRY
|
||||
|
||||
VERIFY(testErr, -1, "H5Itype_exists");
|
||||
if(testErr != -1)
|
||||
goto out;
|
||||
|
||||
H5E_BEGIN_TRY
|
||||
testErr = H5Itype_exists(H5I_ATTR);
|
||||
H5E_END_TRY
|
||||
|
||||
VERIFY(testErr, -1, "H5Itype_exists");
|
||||
if(testErr != -1)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Create a datatype ID and try to perform illegal functions on it
|
||||
*/
|
||||
|
||||
typeID = H5Tcreate(H5T_OPAQUE, (size_t)42);
|
||||
CHECK(typeID, H5I_INVALID_HID, "H5Tcreate");
|
||||
if(typeID == H5I_INVALID_HID)
|
||||
@ -317,7 +339,7 @@ static int id_predefined_test(void )
|
||||
H5Tclose(typeID);
|
||||
|
||||
/* testObj was never registered as an atom, so it will not be
|
||||
* automatically freed. */
|
||||
* automatically freed. */
|
||||
HDfree(testObj);
|
||||
return 0;
|
||||
|
||||
|
@ -946,7 +946,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
|
||||
|
||||
if (searched_err == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
/* If the searched error message is found, stop the iteration */
|
||||
if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user