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

use-of-uninitialized-value error in H5G__ent_to_link #4307

Closed
tbeu opened this issue Apr 2, 2024 · 1 comment · Fixed by #4322
Closed

use-of-uninitialized-value error in H5G__ent_to_link #4307

tbeu opened this issue Apr 2, 2024 · 1 comment · Fixed by #4322
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Milestone

Comments

@tbeu
Copy link
Contributor

tbeu commented Apr 2, 2024

Describe the bug

use-of-uninitialized-value
# 0 0xaef255 in H5G__ent_to_link hdf5/src/H5Gent.c:408:13
# 1 0xb14ded in H5G__node_iterate hdf5/src/H5Gnode.c:934:17
# 2 0x14a0e15 in H5B__iterate_helper hdf5/src/H5B.c:1088:25
# 3 0x14a0553 in H5B_iterate hdf5/src/H5B.c:1127:22
# 4 0xb2fdaa in H5G__stab_iterate hdf5/src/H5Gstab.c:504:26
# 5 0xb21807 in H5G__obj_iterate hdf5/src/H5Gobj.c:664:26
# 6 0xaf5545 in H5G_iterate hdf5/src/H5Gint.c:869:14
# 7 0xc2c073 in H5L_iterate hdf5/src/H5Lint.c:2148:22
# 8 0x13b0b1a in H5VL__native_link_specific hdf5/src/H5VLnative_link.c:364:38
# 9 0x135f815 in H5VL__link_specific hdf5/src/H5VLcallback.c:5482:22
# 10 0x135f815 in H5VL_link_specific hdf5/src/H5VLcallback.c:5516:14
# 11 0xc1a751 in H5L__iterate_api_common hdf5/src/H5L.c:1610:22
# 12 0xc19aa5 in H5Literate2 hdf5/src/H5L.c:1646:22

Additional context

Reported for 9f7b987.

Can likely be fixed by setting lnk->name = NULL; in the called function H5G__ent_to_link or by initializing lnk.name = NULL; (and probably other struct members) in the calling function H5G__node_iterate. Not sure what you prefer and if there are similar cases in the lib.

Introduced by merging #4283 -> relevant for v1.14.4.

@derobins derobins added this to the 1.14.4 milestone Apr 2, 2024
@derobins derobins added Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - C Library Core C library issues (usually in the src directory) Type - Bug Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub labels Apr 2, 2024
jhendersonHDF added a commit to jhendersonHDF/hdf5 that referenced this issue Apr 4, 2024
Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub HDFGroup#4307
@jhendersonHDF jhendersonHDF linked a pull request Apr 4, 2024 that will close this issue
lrknox pushed a commit that referenced this issue Apr 4, 2024
Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub #4307
lrknox pushed a commit to lrknox/hdf5 that referenced this issue Apr 4, 2024
Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub HDFGroup#4307
lrknox added a commit that referenced this issue Apr 4, 2024
* Remove VS ptable error from Known Problems (#4317)

* Simply check for datatypes with unusual number of unused bits (#4309)

Avoids potential undefined behavior in H5T_is_numeric_with_unusual_unused_bits

* Fix issues with empty or uninitialized link names (#4322)

Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub #4307

* Fix h5py testing failure due to invalid datatype IDs (#4321)

Fixes an issue where invalid datatype IDs are passed to application conversion
functions in the case where the top-level conversion function is a library-internal
function that operates on a container-like datatype, but one or more of the
base datatype members are converted with an application conversion function.

* Revise _Float16 configure checks (#4323)

Run configure checks with and without CFLAGS/CMAKE_C_FLAGS since some
compilers work in one case while not working in the other case

Sync CMake configure checks with Autotools
lrknox added a commit to lrknox/hdf5 that referenced this issue Apr 4, 2024
* Remove VS ptable error from Known Problems (HDFGroup#4317)

* Simply check for datatypes with unusual number of unused bits (HDFGroup#4309)

Avoids potential undefined behavior in H5T_is_numeric_with_unusual_unused_bits

* Fix issues with empty or uninitialized link names (HDFGroup#4322)

Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub HDFGroup#4307

* Fix h5py testing failure due to invalid datatype IDs (HDFGroup#4321)

Fixes an issue where invalid datatype IDs are passed to application conversion
functions in the case where the top-level conversion function is a library-internal
function that operates on a container-like datatype, but one or more of the
base datatype members are converted with an application conversion function.

* Revise _Float16 configure checks (HDFGroup#4323)

Run configure checks with and without CFLAGS/CMAKE_C_FLAGS since some
compilers work in one case while not working in the other case

Sync CMake configure checks with Autotools
@tbeu
Copy link
Contributor Author

tbeu commented Apr 6, 2024

qkoziol pushed a commit to qkoziol/hdf5 that referenced this issue Apr 8, 2024
Converts an assertion in H5G_loc_find into a normal error
check that checks for empty link names

Initializes H5O_link_t structure early in H5G__ent_to_link
to avoid trying to free potentially uninitialized memory

Checks for an empty link name after H5MM_strndup in
H5G__ent_to_link

Fixes GitHub HDFGroup#4307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants