Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions release_docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,11 @@ Added Fortran wrapper h5fdsubfiling_get_file_mapping_f() for the subfiling file

Fixed GitHub issue [#4952](https://github.com/HDFGroup/hdf5/issues/4952)

### Fixed security issue CVE-2025-2310

A malformed HDF5 file could have an attribute with a recorded name length of zero.This would lead to an overflow and an invalid memory access. An integrity check
has been added to detect this case and safely stop file decoding.

## Java Library

### Renamed the Callbacks.java file to H5Callbacks.java
Expand Down
6 changes: 6 additions & 0 deletions src/H5Oattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u
if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end))
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
UINT16DECODE(p, name_len); /* Including null */

/* Verify that retrieved name length (including null byte) is valid */
if (name_len <= 1)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "decoded name length is invalid");

if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end))
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
UINT16DECODE(p, attr->shared->dt_size);
Expand All @@ -190,6 +195,7 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u
*/
if (H5_IS_BUFFER_OVERFLOW(p, name_len, p_end))
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");

if (NULL == (attr->shared->name = H5MM_strndup((const char *)p, name_len - 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");

Expand Down
Loading