hdf5
hdf5 copied to clipboard
H5LTfind_dataset() returns true for non-existing datasets
Describe the bug
H5LTfind_dataset()
returns a positive number (i.e. true
) for non-existing datasets. This behavior is observed when there is a dataset whose name starts with the dataset of interest. For instance, imagine we have an HDF5 file which contains only one dataset, named "DayNight". If we inquire about a dataset named, say "Day", we expect the function to return false
but it does return true
.
Expected behavior
Platform (please complete the following information)
Tested with tag 1.14.3
on Linux but this bug is present on the develop
branch, too.
Additional context The bug is due to an incorrect string comparison at
https://github.com/HDFGroup/hdf5/blob/develop/hl/src/H5LT.c#L1231
I suggest this line to be replaced with
if (strcmp(name, (char *)op_data) == 0)