From bc3d878add940845a2ec5b8873f2d45a00926ce8 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 15 Jan 2019 11:48:31 -0600 Subject: Fixed HDFFV-10586 and HDFFV-10588 Description: HDFFV-10586 CVE-2018-17434 Divide by zero inh5repack_filters Added a check for zero value HDFFV-10588 CVE-2018-17437 Memory leak in H5O_dtype_decode_helper This is actually an Invalid read issue. It was found that the attribute name length in an attribute message was corrupted, which caused the buffer pointer to be advanced too far and later caused an invalid read. Added a check to detect attribute name and its length mismatch. The fix is not perfect, but it'll reduce the chance of this issue when a name length is corrupted or the attribute name is corrupted. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test) --- src/H5Oattr.c | 7 ++++++- tools/src/h5repack/h5repack_filters.c | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index c93bf32..c420046 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -176,7 +176,12 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, /* Decode and store the name */ if(NULL == (attr->shared->name = H5MM_strdup((const char *)p))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */ + if(name_len != (HDstrlen(attr->shared->name) + 1)) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length") + if(attr->shared->version < H5O_ATTR_VERSION_2) p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */ else diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 0092abc..123263c 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -338,12 +338,13 @@ int apply_filters(const char* name, /* object name from traverse list */ sm_nbytes = msize; for (i = rank; i > 0; --i) { + if(sm_nbytes == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0"); hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; sm_size[i - 1] = MIN(dims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - HDassert(sm_nbytes > 0); } for (i = 0; i < rank; i++) { -- cgit v0.12 From d584b233a571fcc9854a716590fd09bd9e9320c4 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 20 Jan 2019 16:49:46 -0600 Subject: Fixed HDFFV-10684 Description: The test for HDFFV-10588 has revealed a bug in H5Ewalk. H5Ewalk did not stop midway even when the call back function returns H5_ITER_STOP. This is because a condition is missing from the for loops in H5E__walk causing the callback functions unable to stop until all the errors in the stack are iterated. Quincey advised on the final fix. In this fix, "status" is switched to "ret_value" and HGOTO_ERROR to HERROR, and the for loops won't continue when "ret_value" is not 0. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test) --- src/H5E.c | 4 ++-- src/H5Eint.c | 36 +++++++++++++++++------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index 170133e..3f83355 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1484,7 +1484,7 @@ done: * * Purpose: Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there + * prints error messages. Users are encouraged to write their * own more specific error handlers. * * Return: SUCCEED/FAIL @@ -1567,7 +1567,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi op.vers = 2; op.u.func2 = stack_func; if(H5E__walk(estack, direction, &op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Eint.c b/src/H5Eint.c index 540c9b1..66653ca 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -422,7 +422,7 @@ done: * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and * H5Ewalk2() with a function that prints error messages. - * Users are encouraged to write there own more specific error + * Users are encouraged to write their own more specific error * handlers. * * Return: SUCCEED/FAIL @@ -511,10 +511,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o void *client_data) { int i; /* Local index variable */ - herr_t status; /* Status from callback function */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(estack); @@ -530,9 +529,9 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o if(op->u.func1) { H5E_error1_t old_err; - status = SUCCEED; + ret_value = SUCCEED; if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) { + for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) { /* Point to each error record on the stack and pass it to callback function.*/ old_err.maj_num = estack->slot[i].maj_num; old_err.min_num = estack->slot[i].min_num; @@ -541,12 +540,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o old_err.desc = estack->slot[i].desc; old_err.line = estack->slot[i].line; - status = (op->u.func1)(i, &old_err, client_data); + ret_value = (op->u.func1)(i, &old_err, client_data); } /* end for */ } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) { + for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) { /* Point to each error record on the stack and pass it to callback function.*/ old_err.maj_num = estack->slot[i].maj_num; old_err.min_num = estack->slot[i].min_num; @@ -555,12 +554,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o old_err.desc = estack->slot[i].desc; old_err.line = estack->slot[i].line; - status = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data); + ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data); } /* end for */ } /* end else */ - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + if(ret_value < 0) + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ #else /* H5_NO_DEPRECATED_SYMBOLS */ HDassert(0 && "version 1 error stack walk without deprecated symbols!"); @@ -569,23 +568,22 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o else { HDassert(op->vers == 2); if(op->u.func2) { - status = SUCCEED; + ret_value = SUCCEED; if(H5E_WALK_UPWARD == direction) { - for(i = 0; i < (int)estack->nused && status >= 0; i++) - status = (op->u.func2)((unsigned)i, estack->slot + i, client_data); + for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) + ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data); } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); - for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) - status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); + for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) + ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); } /* end else */ - if(status < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + if(ret_value < 0) + HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ } /* end else */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E__walk() */ -- cgit v0.12 From 41010b8d1e12f01a944afc127bb53234497724a8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 23 Jan 2019 17:25:41 -0600 Subject: Update CMake --- config/cmake/HDF5_Examples.cmake.in | 8 ++++++-- config/cmake/patch.xml | 4 ++-- config/cmake_ext_mod/HDFMacros.cmake | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index d30f2ab..bac174a 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -48,7 +48,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") + if(WIN32) + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") + else() + set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + endif() endif() if(NOT DEFINED CTEST_SOURCE_NAME) @@ -70,7 +74,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.12.4-Source") #endif() ############################################################################################################### diff --git a/config/cmake/patch.xml b/config/cmake/patch.xml index 70571c5..1bdff3e 100644 --- a/config/cmake/patch.xml +++ b/config/cmake/patch.xml @@ -1,5 +1,5 @@ - + - + diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 147ae2f..ede1e67 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -273,7 +273,7 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") - endif () + endif () else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") endif () -- cgit v0.12 From 25cd1ab02b9ddaf58a4f5422f4ab4fde411e050a Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 24 Jan 2019 09:42:19 -0600 Subject: Added test for HDFFV-10588 Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test) --- src/H5E.c | 2 +- test/titerate.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/src/H5E.c b/src/H5E.c index 3f83355..06ae806 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1566,7 +1566,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Walk the error stack */ op.vers = 2; op.u.func2 = stack_func; - if(H5E__walk(estack, direction, &op, client_data) < 0) + if((ret_value = H5E__walk(estack, direction, &op, client_data)) < 0) HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); done: diff --git a/test/titerate.c b/test/titerate.c index de652a7..87ddfb8 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5srcdir.h" #define DATAFILE "titerate.h5" @@ -53,6 +54,17 @@ typedef struct { iter_enum command; /* The type of return value */ } iter_info; +/* Definition for test_corrupted_attnamelen */ +#define CORRUPTED_ATNAMELEN_FILE "memleak_H5O_dtype_decode_helper_H5Odtype.h5" +#define DSET_NAME "image" +typedef struct searched_err_t { + char message[256]; + bool found; +} searched_err_t; + +/* Call back function for test_corrupted_attnamelen */ +static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data); + /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); @@ -915,6 +927,92 @@ static void test_links(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_links() */ +/*------------------------------------------------------------------------- + * Function: find_err_msg_cb + * + * Purpose: Callback function to find the given error message. + * Helper function for test_corrupted_attnamelen(). + * + * Return: H5_ITER_STOP when the message is found + * H5_ITER_CONT, otherwise + * + *------------------------------------------------------------------------- + */ +static int +find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) +{ + int status = H5_ITER_CONT; + searched_err_t *searched_err = (searched_err_t *)_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) + { + searched_err->found = true; + status = H5_ITER_STOP; + } + return status; +} /* end find_err_msg_cb() */ + +/************************************************************************** +** +** test_corrupted_attnamelen(): Test the fix for the JIRA issue HDFFV-10588, +** where corrupted attribute's name length can be +** detected and invalid read can be avoided. +** +**************************************************************************/ +static void test_corrupted_attnamelen(void) +{ + hid_t fid = -1; /* File ID */ + hid_t did = -1; /* Dataset ID */ + searched_err_t err_caught; /* Data to be passed to callback func */ + int err_status; /* Status returned by H5Aiterate2 */ + herr_t ret; /* Return value */ + const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */ + + const char *err_message = "attribute name has different length than stored length"; + /* the error message produced when the failure occurs */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n")); + + fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open the dataset */ + did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); + + /* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should + occur in the decoding stage, so some arguments are not needed. */ + err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL); + + /* Make sure the intended error was caught */ + if(err_status == -1) + { + /* Initialize client data */ + HDstrcpy(err_caught.message, err_message); + err_caught.found = false; + + /* Look for the correct error message */ + ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught); + CHECK(ret, FAIL, "H5Ewalk2"); + + /* Fail if the indicated message is not found */ + CHECK(err_caught.found, false, "test_corrupted_attnamelen: Expected error not found"); + } + + /* Close the dataset and file */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_corrupted_attnamelen() */ + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -951,6 +1049,9 @@ test_iterate(void) test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ } /* end for */ + /* Test the fix for issue HDFFV-10588 */ + test_corrupted_attnamelen(); + /* Close FAPLs */ ret = H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); -- cgit v0.12 From 62277207a4608284a30a4495eab2da8119fcdbd1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 24 Jan 2019 15:56:42 -0600 Subject: Java html fix and cmake update --- config/cmake_ext_mod/HDFMacros.cmake | 4 ++-- java/src/hdf/hdf5lib/H5.java | 12 +++++------- java/src/hdf/overview.html | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index ede1e67..77980c0 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -170,7 +170,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) if (${importtype} MATCHES "IMPORT") set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") endif () - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") + if (${HDF_CFG_NAME} MATCHES "Debug") set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) else () set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) @@ -397,7 +397,7 @@ macro (HDF_DIR_PATHS package_prefix) ) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 807c613..19ca83b 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -70,8 +70,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF * Reference Manual. * - *
- * + *
* * * @@ -107,8 +106,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * * *
HDF-5 C types to Java types
HDF-5Special -- see HDFArray
- *
- *
General Rules for Passing Arguments and Results
+ * General Rules for Passing Arguments and Results *

* In general, arguments passed IN to Java are the analogous basic types, as above. The exception is for arrays, * which are discussed below. @@ -143,7 +141,7 @@ import hdf.hdf5lib.structs.H5O_info_t; *

* All the routines where this convention is used will have specific documentation of the details, given below. *

- * Arrays + * Arrays *

* HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, @@ -176,7 +174,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * and the parameter data can be any multi-dimensional array of numbers, such as float[][], or int[][][], or * Double[][]. *

- * HDF-5 Constants + * HDF-5 Constants *

* The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs * via the class HDF5Constants. For example, the parameters for @@ -196,7 +194,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * The Java application uses both types of constants the same way, the only difference is that the * HDF5CDataTypes may have different values on different platforms. *

- * Error handling and Exceptions + * Error handling and Exceptions *

* The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index edb1b76..e3a032b 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -90,8 +90,7 @@ like this: The H5 class automatically loads the native method implementations and the HDF5 library. -

-To Obtain

+

To Obtain

The JHI5 is included with the HDF5 library. -- cgit v0.12 From 37f5c682b66d503d556c1e5fe99c5c0c98f5e7b3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 24 Jan 2019 16:36:47 -0600 Subject: CMake fix --- config/cmake_ext_mod/HDFMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 77980c0..27d730b 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -397,7 +397,7 @@ macro (HDF_DIR_PATHS package_prefix) ) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) -- cgit v0.12 From 51e0107d18c4ccdc61689c2dc6cc8bbf35edeaab Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 25 Jan 2019 00:19:16 -0600 Subject: Added data file for test and updated MANIFEST --- MANIFEST | 1 + test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 | Bin 0 -> 82816 bytes 2 files changed, 1 insertion(+) create mode 100644 test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 diff --git a/MANIFEST b/MANIFEST index f54560a..bd44d27 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1057,6 +1057,7 @@ ./test/le_extlink2.h5 ./test/lheap.c ./test/links.c +./test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 ./test/mergemsg.h5 ./test/mf.c ./test/mount.c diff --git a/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 new file mode 100644 index 0000000..b5980b7 Binary files /dev/null and b/test/memleak_H5O_dtype_decode_helper_H5Odtype.h5 differ -- cgit v0.12 From 822caec9071019d02da869fe0c9b06f24d88c2d5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 25 Jan 2019 11:36:36 -0600 Subject: Fix CMake on Windows --- config/cmake_ext_mod/HDFMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 27d730b..b3d97ce 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -14,7 +14,7 @@ macro (SET_HDF_BUILD_TYPE) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set(HDF_CFG_NAME ${CTEST_CONFIGURATION_TYPE}) + set(HDF_CFG_NAME \${CTEST_CONFIGURATION_TYPE}) set(HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) set(HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) else() -- cgit v0.12 From 3fac85c00d6253f7b2c96ca46c7b9718d0203029 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 25 Jan 2019 09:58:50 -0800 Subject: Fixed a bug identified by valgrind in the cork test. --- test/cork.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/cork.c b/test/cork.c index dceaf5a..240be77 100644 --- a/test/cork.c +++ b/test/cork.c @@ -286,19 +286,19 @@ static unsigned verify_obj_dset_cork(hbool_t swmr) { /* Variable Declarations */ - hid_t fid = -1; /* File ID */ + hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t aid = -1; /* Attribute ID */ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ hid_t oid = -1; /* Object ID */ - hid_t dcpl2; /* Dataset creation property list */ + hid_t dcpl2; /* Dataset creation property list */ int i = 0; /* Local index variable */ - hsize_t dim[1] = {100}; /* Dataset dimension size */ + hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ H5O_info_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ if(swmr) { TESTING("cork status for dataset objects with attributes (SWMR)"); @@ -341,7 +341,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach and write to an attribute to the dataset: DSET */ - if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -380,11 +380,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Attach 8 attributes to the dataset */ - for(i = 0;i < 8; i++) { - sprintf(attrname, "attr %d", i); - if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) + for(i = 0; i < 8; i++) { + HDsprintf(attrname, "attr %d", i); + if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) + if(H5Awrite(aid, H5T_NATIVE_INT, &i) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR -- cgit v0.12 From ad906dc708fc803e8c5f17963fafa63591d3cc8d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 25 Jan 2019 15:21:11 -0600 Subject: Invalid position of declaration fixed. --- tools/src/h5repack/h5repack_filters.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 123263c..3d9472a 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -338,9 +338,10 @@ int apply_filters(const char* name, /* object name from traverse list */ sm_nbytes = msize; for (i = rank; i > 0; --i) { + hsize_t size = 0; if(sm_nbytes == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0"); - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + size = H5TOOLS_BUFSIZE / sm_nbytes; if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; sm_size[i - 1] = MIN(dims[i - 1], size); -- cgit v0.12 From f522479035c893c9123dbe6b89ae4c71c3d2615e Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sat, 26 Jan 2019 11:58:52 -0600 Subject: Added test file for CMake --- test/CMakeTests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index c0d4813..087461f 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -171,6 +171,7 @@ set (HDF5_REFERENCE_TEST_FILES le_data.h5 le_extlink1.h5 le_extlink2.h5 + memleak_H5O_dtype_decode_helper_H5Odtype.h5 mergemsg.h5 multi_file_v16-r.h5 multi_file_v16-s.h5 -- cgit v0.12