Repository navigation
Conversation
H5Z__filter_nbit and H5Z__filter_scaleoffset assume their input is exactly nelmts * datatype-size bytes, which is only true when they are the first filter in the pipeline. They only checked this with an assert(), which release builds remove. With e.g. deflate before nbit, the smaller buffer was over-read/over-written when writing a chunk. Return an error instead, so the pipeline skips these optional filters. Add a regression test and a changelog entry.
ojessop01
requested review from
fortnern,
glennsong09,
hyoklee,
jhendersonHDF,
lrknox,
mattjala and
vchoi-hdfgroup
as code owners
October 22, 2026 16:14
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
github-actions
Bot
removed request for
fortnern,
glennsong09,
lrknox,
mattjala and
vchoi-hdfgroup
October 22, 2026 16:32
Contributor
Review ChecklistThis PR touches the following areas. Each needs a sign-off
|
Assert that deflate was applied and the second filter was skipped, so the test cannot pass without exercising the bug. Skip it when deflate is unregistered, which test_missing_filter() does for the rest of the run.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
The nbit and scaleoffset filters assume their input is exactly one full chunk (
nelmts * datatype sizebytes). That only holds when they are the first filter in the pipeline. The only check was anassert(), which release builds remove.When it triggers: a chunked dataset where another filter runs before nbit/scaleoffset and makes the chunk smaller, for example
H5Pset_deflate()followed byH5Pset_nbit(). nbit then sizes its output buffer from the smaller input but packs allnelmtselements, so it writes past the end of the buffer (ASan: heap-buffer-overflow inH5Z__nbit_compress_one_byte; without ASan,free(): invalid next size). scaleoffset after deflate shows a heap over-read under ASan.Fix: return an error instead of asserting. Both filters are optional, so the pipeline skips them for that chunk and the data is stored and read back correctly.
Test:
test_filter_after_deflateintest/dsets.cwrites and reads back a deflate+nbit and a deflate+scaleoffset dataset. It checks that deflate really ran and the second filter was skipped, and that the data round trips. Without the fix it aborts under ASan; with it it passes. (It is skipped when deflate is unavailable;test_missing_filter()unregisters deflate for the rest of the process, so it runs once perdsetsrun.)Issue ticket number (GitHub or JIRA)
None.
Checklist before requesting a review