Repository navigation
Fix ColumnConst::getExtremes out-of-bounds access - #98263
Merged
Merged
Conversation
`ColumnConst::getExtremes` was passing the outer `start` and `end` to the inner data column which only has 1 element. When `ExtremesTransform` calls `getExtremes(min, max, 0, size())` on a `ColumnConst`, `size()` returns the number of repeated rows (e.g. 3), but the inner column has only 1 element, causing an assertion failure in `PODArray::operator[]`. For a constant column the extremes are trivially the constant value. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=4e619266af82b18c09f9a7524383f17868c15a54&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_debug%29 Closes #98240 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
1 task
The test uses `extremes = 1`, so the output includes an extremes section (min/max rows) after the data rows. The reference file was missing these lines. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Feb 28, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 28, 2026
clickhouse-gh Bot
added a commit
that referenced
this pull request
Feb 28, 2026
Backport #98263 to 26.2: Fix ColumnConst::getExtremes out-of-bounds access
alexey-milovidov
added a commit
that referenced
this pull request
Mar 1, 2026
Fix ColumnConst::getExtremes out-of-bounds access
groeneai
added a commit
to groeneai/ClickHouse
that referenced
this pull request
Jul 11, 2026
ColumnArray offsets are cumulative array sizes and must be monotonically non-decreasing. The constructor only checked offsets.back() == getData().size(), not monotonicity, so a column whose offsets decrease (offsets[i] < offsets[i-1]) passed construction. offsetAt(i) then exceeds offsets[i], and any consumer that reads the nested column at [offsetAt(i), offsets[i]) indexes it out of bounds. For Array(Nullable(...)) this reaches ColumnNullable::isNullAt, which reads the null map PODArray out of bounds: PODArray<char8_t>::operator[] (out of bounds) ColumnNullable::isNullAt ColumnNullable::compareAtImpl ColumnArray::compareAtImpl ColumnArray::getExtremes ExtremesTransform::transform In debug/sanitizer builds this trips the PODArray bounds assertion and aborts; in release it is an out-of-range read. Seen repeatedly by the BuzzHouse fuzzer (STID 2508-2658 / 2508-2e5d / 2508-2de4) on SELECT ... FORMAT Null with extremes over an Array(Nullable) column. It is the Array(Nullable) sibling of the Nullable family in ClickHouse#98240 (whose ColumnConst variant was fixed in ClickHouse#98263). Fix the root cause instead of the symptom: enforce the monotonicity invariant at the single point of trust, ColumnArray construction, via chassert. This makes the offsets always consistent by construction and aborts a producer that builds an inconsistent column at its own stack in debug/sanitizer builds, where such bugs are caught, instead of far away in a consumer. It is O(rows) but chassert-gated, so release builds keep only the existing O(1) last-offset check and pay nothing. The exact producer of the inconsistent column is not deterministically reproducible, so no consumer-side workaround and no hand-built column test are added. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
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
ColumnConst::getExtremesthat could cause a crash whenextremes = 1is enabled.Summary
ColumnConst::getExtremespassing the outerstart/endto the inner data column (which only has 1 element), causing a PODArray assertion failureextremes = 1whenExtremesTransformcalledgetExtremes(min, max, 0, size())on aColumnConstwrapping aColumnNullableCI report: AST fuzzer (amd_debug)
Closes #98240
🤖 Generated with Claude Code
Version info
26.3.1.14526.2.2.5