Skip to content

Conversation

@bmribler
Copy link
Collaborator

@bmribler bmribler commented Jan 6, 2026

H5Iget_name() documents passing NULL when querying the object name length. However, passing a non-NULL buffer with size == 0 results in undefined behavior if a write is attempted.

This PR defensively treats (name != NULL, size == 0) as a length-only query by setting name = NULL at the API level.

This fixes a security issue.


Important

Fixes buffer underflow in H5Iget_name() by treating (name != NULL, size == 0) as a length-only query.

  • Security Fix:
    • In H5Iget_name() in H5I.c, treat (name != NULL, size == 0) as a length-only query by setting name = NULL to prevent undefined behavior.
  • Behavior:
    • Prevents buffer underflow by ensuring no write attempts are made when size is 0 and name is non-NULL.

This description was created by Ellipsis for 728923c. You can customize this summary. It will automatically update as commits are pushed.

H5Iget_name() documents passing NULL when querying the object name length.
However, passing a non-NULL buffer with size == 0 results in undefined
behavior if a write is attempted. This fix defensively treats
(name != NULL, size == 0) as a length-only query by setting name =
NULL at the API level.

## Library

### Fixes security issue GHSA-5c6x-jmgf-f5vc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmribler , is GHSA-5c6x-jmgf-f5vc valid and correct?
I can't easily locate it on Internet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hyoklee Yes, it is one of the private security issues. There are some similar ones already in the CHANGELOG.md.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmribler , I don't see any in release_docs/CHANGELOG.md that has GHSA.

Do you mean release_docs/HISTORY* files?
They have corresponding CVE-YYYY-XXXXX .

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmribler , I don't see any in release_docs/CHANGELOG.md that has GHSA.

Do you mean release_docs/HISTORY* files? They have corresponding CVE-YYYY-XXXXX .

@hyoklee Yes, but they were entered by mistakes. We will not use GHSA numbers anymore.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this one have a corresponding CVE number? If so, should that be entered instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no CVE number for this issue yet. It's still not public, at least.

@github-project-automation github-project-automation bot moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Jan 7, 2026
Copy link
Contributor

@mattjala mattjala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should throw an error instead of making an assumption about the user's intentions. This would match the H5Iget_name documentation better, which seems like it would consider a non-NULL zero size buffer an invalid input.

@bmribler bmribler marked this pull request as draft January 9, 2026 17:36
@bmribler
Copy link
Collaborator Author

bmribler commented Jan 10, 2026

I think this should throw an error instead of making an assumption about the user's intentions. This would match the H5Iget_name documentation better, which seems like it would consider a non-NULL zero size buffer an invalid input.

My understanding is the documentation says "...a preliminary call to H5Iget_name() with the last two parameters set to NULL and zero respectively can be made.", and does not indicate that they must be NULL and zero to be valid.
That aside, the documentation needs correction on the return value. The function does return FAIL in some cases but the documentation doesn't say so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

6 participants