Skip to content

Conversation

@christian-wojek
Copy link
Contributor

@christian-wojek christian-wojek commented Oct 31, 2025

A malformed file can cause the scale-offset filter to have too little input data causing a heap buffer overflow. Additional checks on the maximum buffer length are required during the decompression.

This PR fixes CVE-2025-2308.

Closes #5868.


Important

Fixes CVE-2025-2308 by adding buffer size checks in decompression functions to prevent heap buffer overflow in H5Zscaleoffset.c.

  • Security Fix:
    • Fixes CVE-2025-2308 by adding buffer size checks in H5Z__scaleoffset_decompress_one_byte() and H5Z__scaleoffset_decompress_one_atomic() to prevent heap buffer overflow.
  • Function Changes:
    • H5Z__scaleoffset_decompress_one_byte() now returns herr_t and checks if *j exceeds buf_size.
    • H5Z__scaleoffset_decompress_one_atomic() and H5Z__scaleoffset_decompress() updated to pass buf_size and handle buffer overflow.
  • Misc:
    • Minor adjustments in H5Z__filter_scaleoffset() to accommodate new buffer size checks.

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

@fortnern
Copy link
Member

fortnern commented Nov 10, 2025

With this change trying to make the distinction between buf_size and buf_len is confusing. Could you rename buf_len to something more descriptive? Perhaps bits_to_fill? Unfortunately this whole file tends to use "len" to mean bits

@christian-wojek
Copy link
Contributor Author

I renamed buf_len to bits_to_fill and dat_len to bits_to_copy to improve readability.

@nbagha1 nbagha1 assigned fortnern and unassigned bmribler Nov 18, 2025
@nbagha1 nbagha1 moved this from To be triaged to Scheduled/On-Deck in HDF5 - TRIAGE & TRACK Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Scheduled/On-Deck

Development

Successfully merging this pull request may close these issues.

Malformed files lead to buffer overflow during scale offset filter decompression

4 participants