From abcdffb9b02ec87fe95a722e4ce9397ed99f79c9 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:28:23 -0400 Subject: [PATCH 1/3] Fix minor spelling in documentation (#4870) --- src/H5Ppublic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index ff46407a717..a718c3d3621 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -2499,8 +2499,8 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * pipeline * \param[in] flags Bit vector specifying certain general properties of * the filter - * \param[in] cd_nelmts Number of elements in \p c_values - * \param[in] c_values Auxiliary data for the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values Auxiliary data for the filter * * \return \herr_t * @@ -2756,7 +2756,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * */ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, - const unsigned int c_values[]); + const unsigned int cd_values[]); /** * \ingroup OCPL * From f39101806f676c14c399752ad733765fc374c685 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Tue, 24 Sep 2024 07:20:06 -0400 Subject: [PATCH 2/3] Fix an incorrect returned value by H5LTfind_dataset() (#4869) H5LTfind_dataset() returns true for non-existing datasets because it only compares up to the length of the searched string, such as "Day" vs "DayNight" (issue GH-4780). This PR applied the user's patch and added tests. --- hl/src/H5LT.c | 2 +- hl/test/test_ds.c | 17 ++++++++--- hl/test/test_lite.c | 24 +++++++++++++++- release_docs/RELEASE.txt | 62 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 98 insertions(+), 7 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 7d44792fbc0..7b55cedeb3b 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1228,7 +1228,7 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if (strncmp(name, (char *)op_data, strlen((char *)op_data)) == 0) + if (strcmp(name, (char *)op_data) == 0) ret = 1; return ret; diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index f85ed81b7fb..0172cb45a22 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1341,10 +1341,11 @@ test_detachscales(void) static int test_char_attachscales(const char *fileext) { - hid_t fid = -1; - hid_t did = -1; - char dsname[32]; - char scalename[32]; + hid_t fid = -1; + hid_t did = -1; + char dsname[32]; + char scalename[32]; + herr_t ds_existed = 0; snprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac"); @@ -1357,6 +1358,14 @@ test_char_attachscales(const char *fileext) if (create_char_dataset(fid, "ac", 0) < 0) goto out; + /* test finding dataset dsname */ + if ((ds_existed = H5LTfind_dataset(fid, dsname)) < 0) + goto out; + if (ds_existed == 0) { + printf("Unexpected result: Dataset \"%s\" does exist\n", dsname); + goto out; + } + if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { snprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac"); if (test_attach_scale(fid, did, scalename, DIM0) < 0) diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 9bbad45d609..23508b79990 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -29,6 +29,9 @@ #define DSET6_NAME "dataset double" #define DSET7_NAME "dataset string" +/* Name of a non-existing dataset, do not create a dataset with this name */ +#define NODS_NAME "dataset" + #define DIM 6 #define ATTR_NAME_SUB "att" @@ -60,6 +63,7 @@ test_dsets(void) hsize_t dims[2] = {2, 3}; hid_t file_id; hid_t dataset_id; + herr_t ds_existed = 0; /* whether searched ds exists */ char data_char_in[DIM] = {1, 2, 3, 4, 5, 6}; char data_char_out[DIM]; short data_short_in[DIM] = {1, 2, 3, 4, 5, 6}; @@ -348,6 +352,23 @@ test_dsets(void) if (strcmp(data_string_in, data_string_out) != 0) goto out; + PASSED(); + + /*------------------------------------------------------------------------- + * H5LTfind_dataset test + *------------------------------------------------------------------------- + */ + + HL_TESTING2("H5LTfind_dataset"); + + /* Try to find a non-existing ds whose name matches existing datasets partially */ + if ((ds_existed = H5LTfind_dataset(file_id, NODS_NAME)) < 0) + goto out; + if (ds_existed > 0) { + printf("Dataset \"%s\" does not exist.\n", NODS_NAME); + goto out; + } + /*------------------------------------------------------------------------- * end tests *------------------------------------------------------------------------- @@ -1075,7 +1096,7 @@ test_integers(void) char *dt_str; size_t str_len; - HL_TESTING3("\n text for integer types"); + HL_TESTING3(" text for integer types"); if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL)) < 0) goto out; @@ -1881,6 +1902,7 @@ test_text_dtype(void) { HL_TESTING2("H5LTtext_to_dtype"); + printf("\n"); if (test_integers() < 0) goto out; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8d5615fcc11..117f923e7e5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -829,6 +829,54 @@ Bug Fixes since HDF5-1.14.0 release =================================== Library ------- + - Fixed an incorrect returned value by H5LTfind_dataset() + + H5LTfind_dataset() returned true for non-existing datasets because it only + compared up to the length of the searched string, such as "Day" vs "DayNight". + Applied the user's patch to correct this behavior. + + Fixes GitHub #4780 + + - Fixed a segfault by H5Gmove2, extending to H5Lcopy and H5Lmove + + A user's application segfaulted when it passed in an invalid location ID + to H5Gmove2. The src and dst location IDs must be either a file or a group + ID. The fix was also applied to H5Lcopy and H5Lmove. Now, all these + three functions will fail if either the src or dst location ID is not a file + or a group ID. + + Fixes GitHub #4737 + + - Fixed a segfault by H5Lget_info() + + A user's program generated a segfault when the ID passed into H5Lget_info() + was a datatype ID. This was caused by non-VOL functions being used internally + where VOL functions should have been. This correction was extended to many + other functions to prevent potential issue in the future. + + Fixes GitHub #4730 + + - Fixed a segfault by H5Fget_intent(), extending to several other functions + + A user's program generated a segfault when the ID passed into H5Fget_intent() + was not a file ID. In addition to H5Fget_intent(), a number of APIs also failed + to detect an incorrect ID being passed in, which can potentially cause various + failures, including segfault. The affected functions are listed below and now + properly detect incorrect ID parameters: + + H5Fget_intent() + H5Fget_fileno() + H5Fget_freespace() + H5Fget_create_plist() + H5Fget_access_plist() + H5Fget_vfd_handle() + H5Dvlen_get_buf_size() + H5Fget_mdc_config() + H5Fset_mdc_config() + H5Freset_mdc_hit_rate_stats() + + Fixes GitHub #4656 and GitHub #4662 + - Fixed a bug with large external datasets When performing a large I/O on an external dataset, the library would only @@ -866,9 +914,21 @@ Bug Fixes since HDF5-1.14.0 release H5Rget_file_name and H5Rget_obj_name both return the name's length without the null terminator. H5Rget_attr_name now behaves consistently with the other two APIs. Going forward, all the get character string - APIs in HDF5 will be modified/written in this manner, regarding the + APIs in HDF5 will be modified/written in this manner regarding the length of a character string. + Fixes GitHub #4447 + + - Fixed heap-buffer-overflow in h5dump + + h5dump aborted when provided with a malformed input file. The was because + the buffer size for checksum was smaller than H5_SIZEOF_CHKSUM, causing + an overflow while calculating the offset to the checksum in the buffer. + A check was added so H5F_get_checksums would fail appropriately in all + of its occurrences. + + Fixes GitHub #4434 + - Fixed library to allow usage of page buffering feature for serial file access with parallel builds of HDF5 From 013b1cd6d728cd17312dcd1e496ce06cdf20996e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 24 Sep 2024 06:34:53 -0700 Subject: [PATCH 3/3] Remove an unused variable from H5FDs3comms.c (#4872) --- src/H5FDs3comms.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 0d1cd0f868a..78ed5273f52 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1761,7 +1761,6 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha }; unsigned setting_count = 3; herr_t ret_value = SUCCEED; - unsigned buffer_i = 0; unsigned setting_i = 0; int found_setting = 0; char *line_buffer = &(buffer[0]);