Repository navigation
Fix out-of-bounds access in getRequiredHeaderPositions for lazy materialization - #101144
Merged
Merged
Conversation
…erialization The loop at line 108 iterated `required_output_positions.size() - num_outputs` times, accessing `non_mapped[i]` without checking `i < non_mapped.size()`. When the DAG has fewer outputs than inputs (e.g., when columns are removed by an expression), `num_outputs` can be smaller than expected, causing the loop to exceed `non_mapped` bounds and trigger a SIGABRT in debug builds. Add `i < non_mapped.size()` as an additional loop bound. CI failure seen in: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100948&sha=7727d7282d1d05a1fcd6c1f9076aee1f066b96e5&name_0=PR&name_1=Stress%20test%20%28amd_debug%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [e018c08] Summary: ✅ AI ReviewSummaryThis PR fixes an out-of-bounds read in ClickHouse Rules
Final Verdict
|
Member
Author
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
Contributor
LLVM Coverage Report
Changed lines: 100.00% (4/4) | lost baseline coverage: 1 line(s) · Uncovered code |
Merged
1 task done
PedroTadim
added a commit
that referenced
this pull request
Sep 8, 2026
Backport #101144 to 26.3: Fix out-of-bounds access in getRequiredHeaderPositions for lazy materialization
kewin-robetti
pushed a commit
to viasoftkorp/ClickHouse
that referenced
this pull request
Sep 11, 2026
…quiredHeaderPositions for lazy materialization
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.
Fix out-of-bounds access in
getRequiredHeaderPositionsfor lazy materialization.The loop at line 108 iterated
required_output_positions.size() - num_outputstimes, accessingnon_mapped[i]without checkingi < non_mapped.size(). When the DAG has fewer outputs than inputs (e.g., when columns are removed by an expression),num_outputscan be smaller than expected, causing the loop to exceednon_mappedbounds and trigger a SIGABRT in debug builds.Add
i < non_mapped.size()as an additional loop bound.CI failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100948&sha=7727d7282d1d05a1fcd6c1f9076aee1f066b96e5&name_0=PR&name_1=Stress%20test%20%28amd_debug%29
#100948
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix out-of-bounds access in lazy materialization optimization that could cause an exception in debug builds.
Documentation entry for user-facing changes
Version info
26.5.1.80(included in26.5and later)26.3.33.14