Fix NULL pointer access when H5A_operator2_t is NULL (#6541)

* Fix NULL pointer access when H5A_operator2_t is NULL

Passing NULL for the callback function pointer to H5Aiterate2 and
H5Aiterate_by_name was not detected, leading to a subsequent access
of an uninitialized pointer. Add a check for this "no operator
specified" case in both functions so they fail gracefully instead.

Fixes GHSA-r7g4-hv2f-5c66 - CVE-2025-9274

* Fix format

* Fix Java test to handle NULL callback to H5Aiterate2
This commit is contained in:
bmribler
2026-07-21 14:21:38 -04:00
committed by GitHub
parent 9eaec3e81a
commit 8a48c7ced8
5 changed files with 29 additions and 3 deletions
+6
View File
@@ -155,6 +155,12 @@ The `h5repack` tool now obtains its default low and high library version bounds
Previously the error stack would be cleared when exiting a data filter, even an internal library filter, so the user could not see what caused the filter to fail. This has been fixed by not treating internal data filters like a user callback. Note that user-defined or third-party filters that use the default error stack will need to print that stack before returning from their callbacks.
### Fixed error when reading variable-length chunked datasets in read-only mode
Passing NULL for the callback function pointer to H5Aiterate2 and H5Aiterate_by_name was not detected, leading to a subsequent access of an uninitialized pointer. This is now fixed.
Fixes CVE-2025-9274
### Fixed error when reading variable-length chunked datasets in read-only mode
When reading from a chunked dataset with a variable-length type, a non-default fill value, and unwritten chunks, the library would internally try to write data to the file and fail due to writing to a read-only file. Reworked the I/O code to avoid these writes in this case. This may also improve performance and file space usage in similar cases with files open with write access.