Commit Graph
94 Commits
Author SHA1 Message Date
Neil Fortner 1d946c7028 Implement internally concurrent multithreading for chunk dataset I/O reads (#6645)
Added 3 new functions to support this: H5TSset_internal_threads(), H5Pset_io_threads(), and H5Pget_io_threads().

This feature internally parallelizes read operations on chunked datasets. H5TSset_internal_threads() is used to enable the feature globally, while H5Pset_io_threads() can be used to disable the feature on a per-operation basis. These functions are only available when the library is configured with HDF5_ENABLE_CONCURRENCY=ON. When performing an internally threaded read, the library will concurrently read from disk, unfilter, and scatter to memory all chunks in a read operation on a chunked dataset. Currently each of these sub-operations is serialized (protected by a mutex), so there is not yet likely to be any performance improvement.
2026-09-15 10:51:57 -05:00
Nayyar 10f1af5528 check object header message size after decoding its header (#6589) 2026-09-12 06:07:49 -05:00
Matt L 355f67ac37 Close datatype IDs derived from memory type in the JNI translation helpers (#6594)
* Close datatype IDs derived from the memory type in the JNI translate helpers

The object-tree read/write helpers in h5util.c derive a base datatype from
the memory type with H5Tget_super() for the variable-length, array and
complex classes, but never closed it. Because an hid_t is not reclaimed when
the native method returns, every read or write of such data leaked at least
one datatype ID for the lifetime of the process, and nested types leaked
one per level.

This PR updates the helpers to close the derived type in their done: blocks,
which covers both the success and the error paths, and to reset the id in the
compound loops to avoid the potential for double closes.

It also has the helpers release the class references that the per-element
helpers look up on entry. These are local references, so they were reclaimed
when the enclosing native method returned, but a compound read calls the helper
once per member per element and held one set per call until then. Releasing
them at the single exit bounds the count of references to the recursion depth.

* Add CHANGELOG entry for the JNI datatype ID leak fix

* Restrict the derived datatype close guards to strictly positive IDs

hid_t 0 is not a valid datatype ID, so H5Tclose(0) would fail.

* Revert "Restrict the derived datatype close guards to strictly positive IDs"

An hid_t of 0 not being a valid ID is a property of the current H5I
encoding rather than a documented guarantee, so the JNI helpers should
not depend on it.
2026-09-11 09:59:03 -05:00
Scot Breitenfeld 109e670e73 Fix h5open_f failing to re-initialize the Fortran interface (#6642) (#6649)
h5close_f reset its count of the objects created by h5open_f with

  CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, &
                          H5OPEN_NUM_OBJ, error)

passing the H5F module variable H5OPEN_NUM_OBJ as the actual argument for
the INTENT(OUT) obj_count dummy, while h5fget_obj_count_f also reads
H5OPEN_NUM_OBJ by use association. F2018 15.5.2.13 prohibits referencing a
variable through use association once it has been redefined through a dummy
argument in the same call, so the result depended on how the compiler
implemented argument association. Where the actual argument was passed by
reference the subtraction collapsed to 0 - 0 and produced the intended zero;
where the compiler used copy-in/copy-out it evaluated 0 - H5OPEN_NUM_OBJ and
left the count negative.

A negative count then defeats the guard at the top of h5open_f, which returns
early when H5OPEN_NUM_OBJ is non-zero. h5open_f reported success without
calling h5init_types_c, leaving H5T_NATIVE_INTEGER and the other predefined
types holding identifiers that h5close_f had released.

h5close_f now assigns the count directly, which is what the comment there has
always described. h5fget_obj_count_f computes into a local variable so that no
caller can reintroduce the aliasing; note that this change alone would make
the old h5close_f call site produce the negative count on every compiler
rather than only on some, so the two belong together. H5OPEN_NUM_OBJ is also
given an initial value, since h5open_f tests it before anything assigns to it.

h5fget_obj_count_f subtracted every object created by h5open_f from a count of
a single object type, so with the interface open a query such as

  CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_FILE_F, n, error)

returned a negative n and hdferr of 0. h5open_f now records what it leaves open
per object type, and a count is adjusted by the recorded value for the types
being counted, so the adjustment does not depend on which types the
initialization creates. The check for a negative count runs both on the value
returned by H5Fget_obj_count and after the adjustment.

h5fget_obj_ids_f applied no such adjustment, so it returned the identifiers
h5open_f opened alongside the application's own and disagreed with
h5fget_obj_count_f about the same query: with only a file and a group open,
H5F_OBJ_ALL_F counted 2 objects but listed 62. The C API reports 2 and 2. An
application walking the list found datatypes it never opened, and closing them
breaks the Fortran interface. h5fget_obj_ids_f now excludes those identifiers,
requesting enough from H5Fget_obj_ids that max_objs of the application's own
can still be returned when the two are interleaved.

The h5open/h5close test verified its object counts by calling
h5fget_obj_count_f after h5close_f, when h5open_f is the only call the Fortran
interface permits. Those checks move to after the interface is reopened, where
they additionally confirm that the predefined types are valid again, that the
preceding h5close_f released the previous h5open_f's types, and that
h5fget_obj_ids_f agrees with h5fget_obj_count_f.

The Fortran tests also aborted unrecoverable failures with STOP, which exits
with a success status whether the stop code is absent or is a string, so a run
that died part way through reported no failure to CTest. They now exit through
h5_exit_f(1). The STOPs that end a run normally, in fflush1 and in the async
test's skip path for a build without MPI_THREAD_MULTIPLE, are unchanged.

Fixes #6642
Fixes #6648

Reported and diagnosed by Dom Heinzeller.
2026-09-01 15:12:55 -05:00
b7b85e7abf Fix CVE-2026-19025 (Reject chunked datasets with mismatched chunk/dspace rank at open time) (#6508)
* Reject chunked datasets with mismatched chunk/dspace rank

H5D__chunk_construct() validates that the chunk layout dimensionality
matches the dataspace rank, but that runs only at dataset creation time.
When an existing dataset is opened, H5D__chunk_init() didn't repeat the
check, so a file whose stored chunk rank disagreed with its dataspace rank
was accepted. During chunk I/O the memory-selection rank (from the
dataspace) and the file-selection rank (chunk ndims - 1) then differ, which
produces a zero stride that causes a divide-by-zero in
H5S__hyper_iter_get_seq_list().

H5D__chunk_init() now performs the same dimensionality check on open (the
stored chunk rank includes the extra element-size dimension, so it must be
exactly one greater than the dataspace rank) and rejects a mismatch with an
error.

Added test_chunk_dims_mismatch() as a regression test in test/dsets.c

Fixes #6491

* Fix typo

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Clarify element-vs-byte wording

* Validate chunk/dataspace rank at layout decode time

Move the stored-chunk-rank vs dataspace-rank consistency check out of
H5D__chunk_init() and into H5O__layout_decode(), so a malformed chunked
layout is rejected as the message is decoded (mirroring the fill/datatype
size check in the fill message decode).

* Update release_docs/CHANGELOG.md

Co-authored-by: Larry Knox <lrknox@hdfgroup.org>

* Update CHANGELOG

* Pin format version bounds in bad chunk layout generator

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
2026-08-28 13:49:02 -05:00
jhendersonHDF f934da4bfe Fix memory leaks and ID reference counting in H5E code (#6607)
When pushing errors to an error stack that is already full, the
library skipped the push operation but didn't inform calling code
about what happened. This resulted in calling code leaking memory,
leaving reference counts on IDs incremented and causing an infinite
loop while closing the library.
2026-08-20 09:42:57 -05:00
Matt L 767ac04b21 Fix standalone example build issues (#6598)
* Build the examples as C++11 to match the HDF5 C++ library

The standalone examples build forces CMAKE_CXX_STANDARD 98, but
H5public.h includes <cinttypes>, which requires C++11. Any C++
translation unit that includes hdf5.h is therefore affected, not just
users of the C++ API, and the HDF5 C++ library itself is built as C++11
(config/flags/HDFCompilerCXXFlags.cmake). The C++ examples do not
compile as a result, against static or shared HDF5 alike.

Only the standalone build is affected, which is why this is not visible
in ordinary use. The C++98 setting lives in BASIC_SETTINGS, and
HDF5Examples/CMakeLists.txt skips that whole block when
EXAMPLES_EXTERNALLY_CONFIGURED is set -- which HDF5 does for its own
in-tree example build (config/cmake/HDF5ExampleCache.cmake). Built in
tree, the examples inherit HDF5's C++11 and compile normally, and that
is the path the CI workflows exercise. The standalone path, where the
C++98 setting does apply, is driven by the release scripts rather than
by the workflows, and has the C++ examples off by default.

* Select the examples' HL, Fortran and C++ libraries on the right variable

When the examples are built standalone against an installed HDF5, the
HL, Fortran and C++ branches choose between the shared and static
libraries using BUILD_SHARED_LIBS, while the C branch just above them
uses H5EXAMPLE_USE_SHARED_LIBS.

H5EXAMPLE_USE_SHARED_LIBS is what decides whether the "shared" or the
"static" component is requested from find_package, so only the matching
HDF5_<linkage>_<lang>_FOUND variables are ever set. BUILD_SHARED_LIBS
cannot select a linkage on its own; it can only agree or fail to match.
Of its four combinations with H5EXAMPLE_USE_SHARED_LIBS, three produce
no observable difference. In the fourth, H5EXAMPLE_USE_SHARED_LIBS=ON
with BUILD_SHARED_LIBS unset, the shared branch is not taken and the
static branch cannot be, so the HL, Fortran and C++ examples are
disabled with "libs not found" even though the libraries are installed
and were found.

Use H5EXAMPLE_USE_SHARED_LIBS, which is the declared option and is
already what the C branch uses.

A build driven through config/examples/CTestScript.cmake does not reach
the broken combination, because it configures with
HDF5Examples/config/cmake/cacheinit.cmake, which forces
BUILD_SHARED_LIBS=ON. A direct cmake invocation without that cache file
does. In either case the HL, Fortran and C++ examples are off by
default, so this is only visible once they are enabled.

BUILD_SHARED_LIBS remains documented as a user option in
config/examples/HDF5_Examples_options.cmake but no longer influences
library selection; that comment should be revisited separately.
2026-08-19 19:31:41 -05:00
Matt LandClaude Opus 5 e4b6a96472 Remove abort on infinite loop during library close (#6532)
* Abort on infinite loop even when error output is disabled

* Remove abort() on infinite close loop

* Update CHANGELOG.md

* Reference the fixed issue in the CHANGELOG entry

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 17:27:01 -05:00
jhendersonHDF 57128d33b2 Fix h5ls issue with quoting when displaying integer data as ASCII characters (#6553)
When using the '-s' (h5ls) or '-r' (h5dump) option to display 1-byte integer datasets and attributes as ASCII characters, a closing double-quote character for data values was dropped in some cases.
2026-08-07 12:27:55 -05:00
jhendersonHDF 3cd70e2bc5 Fix version handling in installed .cmake file to accept newer minor versions (#6593) 2026-08-06 10:15:25 -05:00
Larry Knox 399bc724dc Clean pre-release entries from CHANGELOG.md and update HISTORY-2.X.md. (#6591) 2026-08-04 15:44:27 -05:00
bmribler 33eac87eea Correct miscellaneous mistakes (#6540)
* Correct miscellaneous mistakes

- remove unused calloc'ed pointers
- correct the order of the arguments to memcpy

* Add entry
2026-07-21 14:21:59 -04:00
bmribler 8a48c7ced8 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
2026-07-21 14:21:38 -04:00
9eaec3e81a Fix JNI datatype ID leak in h5str_detect_vlen_str() (#6522)
* Fix JNI datatype ID leak in h5str_detect_vlen_str()

The JNI H5Dread/H5Dwrite/H5Aread/H5Awrite wrappers call h5str_detect_vlen()
on the memory type. For an H5T_ARRAY/H5T_VLEN of a fixed (non-vlen-string)
base type, h5str_detect_vlen_str() acquired the base type via H5Tget_super()
but only closed it when the recursive check returned 1 or a negative error.
When the recursive call returned 0 because no vlen string was found, the base type ID
was leaked.

This PR changes h5str_detect_vlen_str() to close the id unconditionally after the recursive check,
in the same style as the compound-member case in the same function.

A JNI regression test exists at TestH5D.testH5DArray_super_no_id_leak, which reads
an H5T_ARRAY-of-int dataset in a loop and asserts via H5Fget_obj_count() that
no datatype IDs leak.

* Assert non-negative H5Fget_obj_count in array datatype ID leak test

Guard the before/after open-datatype counts against a negative
(failed) H5Fget_obj_count return, which would otherwise let the
equality check pass spuriously. Keep the count scoped to
H5F_OBJ_ALL: the leaked IDs are transient datatypes not attached to
any file, so a per-file count would not see them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Modify CHANGELOG entry

* Modify CHANGELOG again

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
2026-07-21 11:41:43 -05:00
Neil Fortner bafc55cfb0 Enable error printing for internal data filters (#6539) 2026-07-21 09:21:12 -05:00
Matt LandAlb3e3 abbb48b9cb Harden selection decoding (#6525)
* Harden serialized selection decoding

* Clang-format and expand test

* Guard against rank 0 hyperslab selection in serialization

* Add CHANGELOG entry

* Modify CHANGELOG

---------

Co-authored-by: Alb3e3 <74142887+Alb3e3@users.noreply.github.com>
2026-07-17 13:04:11 -05:00
Neil Fortnerandgithub-actions 01b7084924 Avoid converting fill value from memory to file type when reading vlen data from a nonexistent chunk (#6529)
* Avoid converting fill value from memory to file type when reading vlen
data from a nonexistent chunk.

* Committing clang-format changes

* Add Changelog note

* Spelling

* Update changelog note

* Improve test description

* Hopefully make formatter happy

* Hyphenate read-only

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-17 10:30:45 -05:00
6f70e3d276 validate free space section type during sinfo decode (#6476)
* validate free space section type during sinfo decode

* Update release_docs/CHANGELOG.md

---------

Co-authored-by: naruto-lgtm <naruto-lgtm@users.noreply.github.com>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
2026-07-14 20:45:04 -05:00
20f0b9564b reject SOHM list message count exceeding list_max (#6499)
* bound SOHM list decode to list_max messages

* Add tsohm test for out-of-range SOHM list message count

Create a file with a shared-message list index, corrupt the on-disk
message count so it exceeds list_max (repairing the table checksum),
and confirm reopening rejects the file instead of overrunning the
list image buffer and message array.

---------

Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
2026-07-14 13:09:56 -05:00
jhendersonHDF 1325d30b21 ROS3 VFD block cache feature (#6478)
* ROS3 VFD block cache feature

Implements a minimal I/O block cache for files without paged allocation
enabled to better optimize I/O and reduce requests to S3

I/O is cached in fixed-size blocks (16MiB blocks by default) and are kept
in a simple LRU cache that evicts the oldest used block when a new block
needs to be cached

Reading and caching of the initial bytes of a file has been delayed
from file open to the first read for a file instead

API functions have been added for setting/getting the I/O block caching
parameters to be used

* Address comments from review

* Rename 'page' -> 'block'

* Change default block cache size and separate from page buffer logic

* Update CHANGELOG
2026-07-14 11:37:58 -05:00
jhendersonHDF 4883ee1ad8 Improve performance of h5trav interfaces for links to objects (#6400)
For objects with multiple hard links, use hash table to map between
object tokens and pathnames during traversal to avoid linear scan over
all previous objects for each hard link seen

Use separate hash table for h5trav "table" interface to map between
object tokens and an index into the table of visited objects. This
facilitates quick lookups of objects when adding hard link name aliases
for h5repack processing
2026-07-08 15:53:10 -05:00
Scot BreitenfeldandH. Joe Lee cab98811c6 h5repack: fix silent loss of a declared cd_nelmts for UD filters (#6466)
A declared cd_nelmts with no values following it (e.g. UD=<filtn>,<flag>,1)
was never committed to filt->cd_nelmts: the trailing token (no comma after
it) was always treated as a value, never checked against the l/f/p pending
flags the way the comma-triggered branch does. h5repack's own validation
then silently passed since cd_nelmts stayed at its default 0, and the
mismatch was only ever caught by coincidence when the underlying filter
plugin did its own internal cd_values check (issue #6462).

Commit the trailing token to whichever UD field is still pending, mirroring
the comma-triggered branch exactly.

Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
2026-07-01 16:45:16 -05:00
Aleksandar Jelenak 55d179733c Fix HTTP 403 errors in ROS3 VFD for object keys that need URI encoding (#6441)
The ROS3 VFD appended the raw object key to the HTTP request path.
Because the signing configuration disables use_double_uri_encode (the
correct setting for S3), the SigV4 signer uses the request path
verbatim, so keys containing characters that AWS requires to be
percent-encoded -- such as '=' in Hive-style "key=value" partition
prefixes, '+', or spaces -- produced signatures that disagree with
S3's server-side recomputation. S3 rejects such requests with
SignatureDoesNotMatch, surfaced as a bodyless HTTP 403 that is
indistinguishable from a permissions error on a HEAD request, even
though other S3 clients (AWS CLI, boto3, s3fs) could read the same
objects.
2026-06-12 08:16:37 -04:00
Scot Breitenfeld a3892b08aa ☀️ Fix memory safety vulnerabilities in high-level and VFD code (#6140)
* Fix memory safety vulnerabilities in high-level and VFD code

H5FDstdio (src/H5FDstdio.c):
- Fix five error paths in H5FD_stdio_open() that called fclose(f) after
  free(file): the correct resource to close is file->fp.  Reorder to
  fclose before free to match standard cleanup idiom and prevent file
  descriptor leaks under memory-pressure failures.

H5VLnative (src/H5VLnative.c):
- Add assert(obj) and assert(file) to H5VL_native_get_file_struct() to
  catch NULL-pointer programming errors early in debug builds.

H5LT (hl/src/H5LT.c):
- Add NULL check after strdup() in H5LTtext_to_dtype(); push H5E_NOSPACE
  so the HDF5 error stack is populated on OOM.
- Fix H5Tclose(super) leak in H5T_ENUM, H5T_VLEN, H5T_ARRAY, H5T_COMPLEX
  branches of H5LT_dtype_to_text(): super was only closed on the success
  path; any failure between H5Tget_super and the final realloc_and_append
  leaked the type ID.  Super is now closed immediately after use.
- Refactor the repeated "get super-type text and append" pattern (four
  near-identical ~15-line blocks) into static helper append_dtype_super_text().
  Pushes H5E_NOSPACE on internal calloc failure.
- Rewrite realloc_and_append() doc comment to document the asymmetric
  ownership contract (callee frees buf on realloc failure in
  library-managed mode; no free in user-buf mode).
- Move the buf == NULL guard to before the _no_user_buf branch so both
  modes short-circuit identically.

H5TB (hl/src/H5TB.c):
- Clarify H5TBget_field_info() else-branch comment: the two-branch copy
  structure is an efficiency optimization (copy name_len+1 bytes rather
  than HLTB_MAX_FIELD_LEN-1), not a backward-compatibility concern.

CHANGELOG (release_docs/CHANGELOG.md):
- Add entries for the stdio VFD leak fix, VOL NULL checks, and H5LT
  memory-safety improvements.

* HL: add realloc_and_append invariant comments per fortnern review

Document the failure-path contract for realloc_and_append: buf is
passed by value so the caller's pointer is never written by the
function; failure is signaled solely through a NULL return; in
library-managed mode the underlying memory is freed on failure so
callers must not access the original pointer afterward.

Also annotate the point after a successful realloc where the
function can no longer fail.



* HL: reposition 'cannot fail' comment before buf assignment

The comment should mark the transition out of the failure zone —
after the only exit path (goto out), before buf = tmp_realloc.
Also drop the redundant else since the if body always exits.

* HL: fix nested comment syntax error in realloc_and_append Note
2026-06-04 13:35:06 -05:00
Aleksandar Jelenak 00af022f1e Change h5repack low library bound to H5F_LIBVER_V18 (#6352) 2026-05-26 15:00:56 -04:00
Scot Breitenfeld 853451a3a7 HL: Fix prefix-match bugs in H5TB field lookup and H5DS/H5IM CLASS checks (#6371)
- H5TB: strcmp replaces strncmp in H5TBfind_field so that field names
  that are a prefix of a requested name (or vice-versa) are no longer
  matched. HLTB_MAX_FIELD_LEN (255) is now public in H5TBpublic.h and
  exposed to Fortran as HLTB_MAX_FIELD_LEN_F in H5TBff.F90.
  H5TBget_field_info documents the buffer-size requirement and truncation
  behaviour. H5TBget_field_info guards against overflow on long names.

- H5IM: H5IMis_image and H5IMis_palette refactored into a shared helper
  (H5IM__class_attr_equals). The helper now reads both fixed-length and
  variable-length CLASS string attributes, using H5Treclaim for VL memory.
  strcmp replaces strncmp for exact-match semantics.

- H5DS: H5DSis_scale and H5DS_is_reserved both support variable-length
  CLASS string attributes via H5Aget_space/H5Aread/H5Treclaim. The
  fixed-length path retains the 16-byte size guard. strcmp is used
  throughout for exact comparison.

- Tests: new test functions test_is_scale_class_prefix,
  test_is_reserved_class_prefix, and test_class_prefix cover fixed-length
  prefix/exact/wrong-value cases and variable-length string cases.
  test_table.c adds write and read field-name prefix rejection cases and
  boundary-length truncation verification. All malloc calls are NULL-checked.

- CHANGELOG updated with a summary of all fixes.
2026-05-22 11:28:24 -05:00
86bdc78365 ✨[Feature] Digital Signature Verification for HDF5 Plugins (#6198)
feat: add optional digital signature verification for HDF5 filter plugins

Introduce an opt-in plugin signing and verification system that allows
HDF5 deployments to require cryptographically signed filter plugins before
loading them. Disabled by default (HDF5_REQUIRE_SIGNED_PLUGINS=OFF).

New tool: h5sign
- Signs plugin shared libraries by appending an RSA signature and a
  14-byte footer (algo_id | sig_len | 8-byte magic | format_ver) to the
  binary without modifying the original content.
- Supports SHA-512 (default), SHA-256, SHA-384, and their PSS variants
  (-a/--algorithm flag).
- Detects already-signed plugins; --force strips the old signature and
  re-signs.
- Security hardened: keeps the file descriptor open through hashing and
  appending (no TOCTOU window), enforces a 2048-bit minimum RSA key size,
  rolls back partial writes on failure, and rejects paths that are not
  regular files.

Verification (H5PLsig.c)
- At plugin load time, reads the footer, validates the magic and format
  version, then checks the RSA signature against all public keys found in
  the KeyStore directory.
- File is hashed once; per-key verification operates on the pre-computed
  digest (no redundant I/O for multi-key keystores).
- Plugins whose signature hash appears in revoked_signatures.txt are
  rejected regardless of key validity.
- Runtime debug output via HDF5_DEBUG=pl.

KeyStore management
- Trusted public keys are PEM files in a directory specified by
  HDF5_PLUGIN_KEYSTORE_DIR (build time) or HDF5_PLUGIN_KEYSTORE (env var).
- HDF5_LOCK_PLUGIN_KEYSTORE cmake option disables the env-var override for
  security-hardened deployments.

Test infrastructure
- h5signverifytest: positive, negative, tamper, re-sign, and revocation
  test cases.
- CTest fixture-based dependency graph (FIXTURES_SETUP/FIXTURES_REQUIRED)
  replaces fragile DEPENDS chains so tests remain correct under -R filtering.
- Dedicated signed-plugins.yml CI workflow; full test suite scoped to
  H5SIGN and H5PLUGIN-signature tests to avoid unrelated flaky failures.
- Cross-platform: Linux, macOS, and Windows (MSVC-compatible, BIO-based
  OpenSSL I/O, HDsleep/HDsetenv portability wrappers).

Documentation: docs/PLUGIN_SIGNATURE_README.md covers usage, footer
format, revocation file format, FAQ, and troubleshooting.

Co-authored-by: Glenn Song <gsong@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-06 09:35:19 -05:00
Neil Fortner d926e3cbd0 Various fixes to handling of chunk buffers (#6184)
Verify uncompressed chunks are the right size after being uncompressed (reverse filtered)
Verify that the buffer returned from the filter callback is large enough to hold the returned data size
Fix bug in deflate filter that caused it to report the wrong buffer size
Fix bug in chunk copy code that could cause a background buffer overflow
Fix bug in chunk copy code that could cause a double free if the filter realloced the data buffer
Other general cleanup
2026-04-29 10:40:17 -05:00
Matt L f010df9fe6 Make JAR dep paths modifiable (#6331) 2026-04-13 10:15:10 -05:00
Simon's Hub d35c31c516 Fix integer overflow in array datatype nelem computation (#6350)
The loop in H5O__dtype_decode_helper() that computes nelem by multiplying array dimension sizes has no per-step overflow check.

This produces incorrect element counts that propagate through type conversion, vlen iteration, and size calculations.

Add a per-step overflow guard inside the multiplication loop so the wrap is caught before it happens.
2026-04-08 15:02:17 -05:00
Scot Breitenfeld cbff0315f3 Default versioned API functions to earliest version for older API settings (#6280)
When a global API version is set (e.g., H5_USE_16_API), functions
introduced after that version now default to their earliest version
(version 1) instead of the latest. This prevents breakage when an
application uses an older API setting but calls functions that were
later versioned.
2026-04-07 11:06:32 -05:00
Larry Knox 5c96f3ba48 Deleted 3 entries from develop branch CHANGELOG.md that were duplicates (#6334) 2026-04-03 11:20:41 -05:00
Scot Breitenfeld 05676d1abe Consolidate documentation under docs/ directory (#6310)
* Consolidate documentation under doc/ directory

Move user-facing guides from release_docs/ and doxygen/ into a single
doc/ root. release_docs/ now holds only release artifacts (changelogs,
history, release process, maintainer info).

- git mv release_docs/INSTALL*.md, USING_*.md, README_HPC.md,
  BuildSystemNotes.md, AutotoolsToCMakeOptions.md,
  HDF5_Library_2.0.0_Migration_Guide.md → doc/
- git mv doxygen/ → doc/doxygen/
- Update CMakeLists.txt: HDF5_DOXYGEN_DIR and add_subdirectory path
- Update CMakeInstallation.cmake: all install paths for moved files
- Update bin/make_vers: hardcoded doxygen/ path substitution
- Update doc/doxygen/CMakeLists.txt: EXAMPLES_DIRECTORY and comments
- Update README.md, CONTRIBUTING.md, SECURITY.md, config/README.md,
  release_docs/RELEASE_PROCESS.md: links to moved files
- Update doxygen .dox files: release_docs/ URLs for moved guides
- Rewrite release_docs/README.md for narrowed scope

* Add HDF5_DOCS_DIR variable for doc/ root path

Introduce HDF5_DOCS_DIR = \${HDF5_SOURCE_DIR}/doc so that
CMakeInstallation.cmake and future callers reference the doc/
directory symbolically rather than by hardcoded path.
HDF5_DOXYGEN_DIR is now derived from HDF5_DOCS_DIR.
2026-03-31 17:01:54 -06:00
jhendersonHDF 0c734cbe80 Fix cache image testing issues and re-enable testing (#6311)
Fix issue where chunked datasets could get setup with an incorrect
chunking index type in parallel HDF5

Fix issue where metadata cache images with an undefined address
and size of 0 couldn't be properly decoded

Fix issue where a flag in H5Cimage.c wasn't getting set correctly
for release builds of the library, leading to incorrect error
checking when reconstructing metadata cache entries
2026-03-27 11:29:18 -05:00
jhendersonHDF 9dbc54dcf6 Fix data alignment requirements check in direct I/O VFD (#6324)
During file creation, the direct I/O VFD only checked data alignment
requirements for writes and assumed they were the same for reads.
Checks are now performed separately for writes and reads. In order
to avoid EINVAL errors, the VFD is also now slightly more conservative
about when it tries to avoid performing extra work when data alignment
isn't required.
2026-03-26 20:47:42 -05:00
Larry Knox 8f2ee48e8f Add 2.1.0 CHANGELOG to HISTORY-2.X.md and set release default to draft. (#6291)
* Add 2.1.0 CHANGELOG to HISTORY-2.X.md.
Set release default to draft.

* Updated CHANGELOG.md Executive Summary "Important" section similar to
that in HDF5 2.1.0 release.
2026-03-17 09:27:10 -05:00
jhendersonHDF 5a11a79fc4 Improvements to CMake logic for handling filters (#6287)
* Re-write zlib/szip CMake logic for clarity

* Update external libaec, zlib-ng and zlib builds to not use patching process

* Add FindZLIBNG module to locate zlib-ng on system

* Rework HDF5 filter plugins support
2026-03-16 13:46:48 -05:00
Neil Fortner 950f47492f Improve performance of H5Ovisit with deeply nested groups (#6272)
Improve performance of H5Ovisit (and H5Ocopy, and functions that
retrieve and object name) by passing more information about the visited
object from the underlying H5G_visit routine to these callbacks.
Introduced an internal object callback for H5G_visit to facilitate this.
H5Ovisit1 and potentially H5Ovisit2 are still slow with deeply nested
groups due to the way these deprecated functions interact with the VOL
layer.
2026-03-13 13:51:24 -05:00
Scot Breitenfeld a7ec64a857 Split static targets into separate optional target [UPDATED] (#6216)
Build-tree exports can't diverge from install-tree exports — the export(EXPORT ...) reads directly from the install export sets. No manual list to keep in sync.

Removed 3 global variables (HDF5_STATIC_LIBRARIES_TO_EXPORT, HDF5_JAVA_LIBRARIES_TO_EXPORT, HDF5_UTILS_TO_EXPORT) and their ~21 set_global_variable calls across tool/utility files.

Fixed the static-only build bug in the PR where the base export set was guarded by BUILD_SHARED_LIBS, breaking tools export.

Removed redundant utils in export files — the PR was dumping tools into all three build-tree export files (java, static, shared). Now they correctly appear only in the base export.
2026-02-24 17:04:25 -06:00
jhendersonHDF 5de837660f Remove force-setting of ZLIB_USE_EXTERNAL / SZIP_USE_EXTERNAL (#6222)
Removes the force-setting of ZLIB_USE_EXTERNAL and SZIP_USE_EXTERNAL to
ON when HDF5_ALLOW_EXTERNAL_SUPPORT is GIT or TGZ so that zlib and
szip can be independently built from the system or externally as desired
2026-02-18 11:47:40 -07:00
Larry Knox 448ae0a94f Update develop branch version / Clean CHANGELOG.md entries (#6211)
* Advance version to 2.1.1 after creating release branch for 2.1.0
release.

* Update develop branch version to 2.2.0
Clean 2.1.0 entries from CHANGELOG.md

* Add notice for removing alternate release tag to CHANGELOG.md.
Fix typo.

* Fix typo

* Reorder AGE and REVISION for consistent order for all libraries.

* Temporarily remove develop branch restrictions from workflows.

* Revert "Temporarily remove develop branch restrictions from workflows."

This reverts commit abc7039fc5.
2026-02-10 12:09:47 -05:00
bmribler 8cd9f7a7ba Validate datatype size for consistency (#6173)
User report:
When a file is corrupted such that an array datatype's size, the number of elements,
and the element size are not in agreement, it can trigger an out of bounds read.
(private GH issue: GHSA-gh44-7wpq-622f)
Added a validation to ensure the above are in agreement.
2026-02-03 15:26:51 -06:00
Neil Fortner d069f15269 Fix CVE-2025-44904 (#6179)
Fix potential buffer overflow due to invalid chunk size reported by chunk index
(CVE-2025-44904)
2026-02-02 16:10:04 -06:00
jhendersonHDFandLarry Knox dd3080a58c Fix double-free issue in H5D__chunk_copy (#6160)
Fix double-free caused by loss of buffer pointer after re-allocation

Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
2026-01-27 05:55:38 -06:00
bmribler 9268b803b7 Fixes buffer underflow (#6143)
Fixes security issue by treating non-NULL buffer with size 0 as length-only query in get_name API functions.

Behavior:
Modify get_name API functions to treat (buffer != NULL, size == 0) as length-only queries, preventing undefined behavior.
Fix applied to H5Aget_name, H5Aget_name_by_idx, H5Fget_name, H5Gget_objname_by_idx, H5Iget_name, H5Lget_name_by_idx, H5Rget_file_name, H5Rget_obj_name, H5Rget_attr_name, and 8 other functions.
Tests:
Update test/links.c, test/tattr.c, test/tfile.c, test/titerate.c, and test/trefer.c to verify new behavior with non-null buffer and size 0.
Documentation:
Update comments in H5A.c, H5F.c, H5Gdeprec.c, H5I.c, H5L.c, H5R.c, and H5Rdeprec.c to reflect new behavior.t]@users.noreply.github.com>
2026-01-26 18:07:23 -06:00
jhendersonHDF ed5eceab58 Enable data sieving for chunks that can't be cached (#6111)
* Enable data sieving for chunks that can't be cached

Fixed an issue that prevented use of a data sieve buffer for I/O on dataset
chunks when those chunks couldn't be cached by the library. This issue
could result in worst-case behavior of I/O on a single data element at a
time when chunks are non-contiguous with respect to memory layout.

Added a test to attempt to catch performance regressions in I/O on dataset
chunks that are non-contiguous with respect to memory layout

Updated the External File List logic to set the data sieve buffer size to
the smaller of the dataset size and the size set in the FAPL, similar to
the logic elsewhere in the library
2026-01-23 10:58:11 -06:00
Scot Breitenfeld 5711c7466f Update the version to 2.1 (#6147)
Update version to 2.1 and derive version information from H5public.h, removing h5vers script and updating CMake and Java configurations.

Versioning:
Update version to 2.1 in H5public.h.
Derive version strings in H5public.h using macros.
CMake:
Extract version from H5public.h in HDF5config.cmake and HDF5AsSubdirMacros.cmake.
Configure README.md and CHANGELOG.md using CMakeLists.txt.
Java:
Generate H5Version.java from H5public.h for version consistency.
Update H5.java to use H5Version for version constants.
Removals:
Delete bin/h5vers script, previously used for version management.
2026-01-21 23:02:49 -06:00
jhendersonHDF b100609caa Add Findlibaec CMake module for locating libaec (#6152) 2026-01-13 09:26:40 -06:00
jhendersonHDF d1efeba7be Add predefined datatype for FP4 format (#6122)
Adds predefined datatype for FP4 data in E2M1 format

Does not add support for any native FP4 types; datatype conversions are performed in software
2025-12-31 11:44:08 -06:00
jhendersonHDF 441d83a896 Add predefined datatypes for FP6 formats (#6097)
Adds predefined datatypes for FP6 data in E2M3 and E3M2 formats

Does not add support for any native FP6 types; datatype conversions are performed in software
2025-12-19 12:56:54 -06:00