fix: resolve Miri UB in null struct field test, re-enable Miri on PRs#3669
Merged
andygrove merged 2 commits intoapache:mainfrom Mar 11, 2026
Merged
fix: resolve Miri UB in null struct field test, re-enable Miri on PRs#3669andygrove merged 2 commits intoapache:mainfrom
andygrove merged 2 commits intoapache:mainfrom
Conversation
Add bounds-checking debug_assert in SparkUnsafeRow::get_element_offset to catch out-of-bounds accesses early. Fix test_append_null_struct_field_to_struct_builder which had an undersized 8-byte buffer (only null bitset, no field slot) with null bit unset, causing an out-of-bounds read in get_long. Use 16 bytes with bit 0 set to properly represent a null field. Re-enable Miri on pull_request trigger now that the upstream cargo nightly regression (apache#3499) is resolved.
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.
Which issue does this PR close?
Closes #3499.
Rationale for this change
The Miri CI workflow on
mainis failing with undefined behavior intest_append_null_struct_field_to_struct_builder. Additionally, Miri was disabled on PR builds due to an upstream cargo nightly regression that has since been resolved.What changes are included in this PR?
debug_assertinSparkUnsafeRow::get_element_offsetto catch out-of-bounds element accesses earlytest_append_null_struct_field_to_struct_builder: the test buffer was only 8 bytes (just the null bitset with no field value slot) and the null bit was unset, soappend_fieldtreated the field as non-null and attempted to read 8 bytes past the end of the buffer. Fixed to use 16 bytes with bit 0 set to properly represent a null field.pull_requesttrigger now that the upstream cargo nightly regression is resolvedHow are these changes tested?
The existing
test_append_null_struct_field_to_struct_buildertest is the fix itself — it was the source of the Miri UB. The debug assertion will cause a panic in debug/test builds if any future test constructs an undersized row buffer.