Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
a-shahba opened this issue Aug 28, 2024 · 0 comments
Closed

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

a-shahba opened this issue Aug 28, 2024 · 0 comments
Assignees
Labels
Component - High-Level Library Code in the hl directory Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug Please report security issues to [email protected] instead of creating an issue on GitHub
Milestone

Comments

@a-shahba
Copy link

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)

@derobins derobins added this to the 1.14.5 milestone Aug 29, 2024
@derobins derobins added Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - High-Level Library Code in the hl directory Type - Bug Please report security issues to [email protected] instead of creating an issue on GitHub labels Aug 29, 2024
bmribler added a commit to bmribler/hdf5_bmr23 that referenced this issue Sep 23, 2024
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 HDFGroupGH-4780).

This PR applied the user's patch and added tests.
derobins pushed a commit that referenced this issue Sep 24, 2024
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.
lrknox pushed a commit to lrknox/hdf5 that referenced this issue Sep 27, 2024
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 HDFGroupGH-4780).

This PR applied the user's patch and added tests.
lrknox added a commit that referenced this issue Sep 28, 2024
* Fix issues with large external data files (#4843) (#4847)

* Fixed a memory leak from H5FL_blk_malloc (#4882)

In H5F__accum_reset(), when H5F__accum_flush() failed, the freeing of
f_sh->accum.buf was never reached, causing resource leak.

@fortnern added the third argument to H5F__accum_reset() so we can free
f_sh->accum.buf when we close the file, that is, when H5F__accum_reset()
is called from the H5F__dest() route, and can leave the accumulator in place
otherwise.

* Added an entry for the GH-4585 fix (#4889)

* 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.

* Fix minor spelling in documentation (#4870)

---------

Co-authored-by: Neil Fortner <[email protected]>
Co-authored-by: bmribler <[email protected]>
lrknox added a commit that referenced this issue Sep 28, 2024
* Fix issues with large external data files (#4843) (#4847)

* Fixed a memory leak from H5FL_blk_malloc (#4882)

In H5F__accum_reset(), when H5F__accum_flush() failed, the freeing of
f_sh->accum.buf was never reached, causing resource leak.

@fortnern added the third argument to H5F__accum_reset() so we can free
f_sh->accum.buf when we close the file, that is, when H5F__accum_reset()
is called from the H5F__dest() route, and can leave the accumulator in place
otherwise.

* Added an entry for the GH-4585 fix (#4889)

* 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.

* Fix minor spelling in documentation (#4870)

* Updated Platforms tested in RELEASE.txt
Incremented version subrelease to -3.
lrknox added a commit that referenced this issue Sep 30, 2024
* Fix issues with large external data files (#4843) (#4847)

* Fixed a memory leak from H5FL_blk_malloc (#4882)

In H5F__accum_reset(), when H5F__accum_flush() failed, the freeing of
f_sh->accum.buf was never reached, causing resource leak.

@fortnern added the third argument to H5F__accum_reset() so we can free
f_sh->accum.buf when we close the file, that is, when H5F__accum_reset()
is called from the H5F__dest() route, and can leave the accumulator in place
otherwise.

* Added an entry for the GH-4585 fix (#4889)

* 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.

* Fix minor spelling in documentation (#4870)

* Set release version 1.14.5 and release date to 2024-09-30.
lrknox pushed a commit to lrknox/hdf5 that referenced this issue Oct 2, 2024
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 HDFGroupGH-4780).

This PR applied the user's patch and added tests.
lrknox pushed a commit that referenced this issue Oct 2, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - High-Level Library Code in the hl directory Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug Please report security issues to [email protected] instead of creating an issue on GitHub
Projects
None yet
Development

No branches or pull requests

3 participants