Skip to content

H5LTfind_dataset() returns true for non-existing datasets #4780

@a-shahba

Description

@a-shahba

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions