Skip to content

Resolve the 26.3 cherry-pick of #109212: Verify array offsets read as absolute values, not only in the Native format - #119263

Closed
groeneai wants to merge 1 commit into
ClickHouse:26.3from
groeneai:groeneai/resolve-26.3-cherry-pick-109212
Closed

groeneai wants to merge 1 commit into
ClickHouse:26.3from
groeneai:groeneai/resolve-26.3-cherry-pick-109212

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Rejects non-monotonic Array offsets on every read path that decodes them as absolute values, instead of only in the Native format. A corrupt set skip index granule previously passed unchecked and was then read out of bounds.

Description

Related: #109212 (the merged master fix, pr-must-backport), #118921 (the robot 26.3 leg). 26.3 is the only branch of the wave still missing it: #118922 (26.6) and #118923 (26.7) merged green.

The robot leg cannot deliver it: its head f5e115bf carries the correct one-line adaptation alongside a whole-repository deletion, +1 / -997,602 over 4033 files, so the branch is unmergeable and, .github/ being deleted, no workflow can trigger on it. I have no push access to it (push: false, maintainerCanModify: false), so this PR carries the same content against 26.3, as #116837 did.

The content is the robot's own two-file cherry-pick, one line adapted. 26.3 predates #96563, which added the static SerializationArray::create / SerializationNumber<T>::create factories, so the ported test's line 61 does not compile here. That reddens Build (amd_debug), (amd_asan) and (amd_tsan) on #118921: three errors, all on that line. It becomes std::make_shared<SerializationArray>(std::make_shared<SerializationNumber<UInt8>>()), 26.3's own idiom, byte-identical to the adaptation already on the robot branch. SerializationArray.cpp is verbatim: both changed hunks are byte-identical to 26.6, differing elsewhere in those two functions only by its #96563 pool idiom. So 26.3 converges on what its siblings ship.

Validated with clang-21, which 26.3 pins: the translation unit reproduces the three CI errors without the adaptation and is clean with it; unit_tests_dbms builds and all 8 SerializationArrayOffsets cases pass, 400 of 400 over 50 shuffled repeats; with the source hunks reverted and the test kept, three of the eight fail, so the ported tests are not vacuous here.

A single push resetting backport/26.3/109212 to d11769ca6 plus this line would be cheaper; say so and I will close this. One cost: under a groeneai/... head the automated Backported to list on #109212 will not pick up 26.3, since tests/ci/pr_version_info.py scans that head ref; this PR still gets its own Merged into line.

Deliver the 26.3 leg of the merged fix "Verify array offsets read as
absolute values, not only in the Native format" (ClickHouse#109212, `pr-bugfix` +
`pr-must-backport`). 26.3 is the only branch of that backport wave still
missing it: ClickHouse#118922 (26.6) and ClickHouse#118923 (26.7) merged green.

The robot leg ClickHouse#118921 cannot deliver it. Its head `f5e115bf` carries the
correct one-line adaptation together with a whole-repository deletion
(+1 / -997,602, 4033 files removed), so the branch is unmergeable and,
because `.github/` is among the deleted paths, no workflow can trigger
on it. I have no push access to that branch (repo `push: false`,
`maintainerCanModify: false`), so this PR carries the same content
against 26.3 instead.

Content is the robot's own two-file cherry-pick with exactly one line
adapted. 26.3 predates ClickHouse#96563 "Added a serialization object pool", which
introduced the static `SerializationArray::create` and
`SerializationNumber<T>::create` factories and made the constructors
private, so the ported test's

    SerializationArray::create(SerializationNumber<UInt8>::create())

does not compile here. That is what reddened `Build (amd_debug)`,
`Build (amd_asan)` and `Build (amd_tsan)` on ClickHouse#118921: three errors, all
at `gtest_serialization_array_offsets.cpp:61`. It becomes

    std::make_shared<SerializationArray>(std::make_shared<SerializationNumber<UInt8>>())

which is 26.3's own idiom (`DataTypeArray.cpp`) and is byte-identical to
the adaptation already applied on the robot branch at `f5e115bf`.

`SerializationArray.cpp` is taken verbatim, with no adaptation. Both
hunks it adds are byte-identical to 26.6, where the same backport merged
green, and `deserializeBinaryBulkWithMultipleStreams` matches 26.6's
whole function. Inside `deserializeOffsetsBinaryBulk` the one remaining
difference is the pre-existing line that constructs
`SerializationNumber<ColumnArray::Offset>` directly where 26.6 goes
through the ClickHouse#96563 pool. So 26.3 converges on the behaviour its siblings
already ship rather than getting a variant of the fix.

Validated on this branch with clang-21, the compiler 26.3 pins: the
single translation unit reproduces the three CI errors with the
pre-adaptation line and compiles clean with it; `unit_tests_dbms` builds
and all 8 `SerializationArrayOffsets` cases pass; with the
`SerializationArray.cpp` hunks reverted and the test kept,
`RejectsDecreasingAbsoluteOffsets`, `RejectsDecreaseAcrossRangeBoundary`
and `RejectsEmptyElementsWithNonZeroLastAbsoluteOffset` fail, so the
ported tests are not vacuous here.

Related: ClickHouse#109212
Related: ClickHouse#118921

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 2 rounds, 1 finding; my own cold
pass added 3 nits). No blocker or major is outstanding. Nothing in the shipped diff was changed by
the fix round: the tree is byte-frozen, only the commit message was corrected.

# Sev Finding Verdict Evidence / action
1 ⚠️ The description claimed both changed functions are byte-identical to 26.6 AGREE, fixed @ 3b610e3 Only deserializeBinaryBulkWithMultipleStreams is identical as a whole function. Reworded to "both changed hunks", with the residual named: inside deserializeOffsetsBinaryBulk, 26.6 constructs SerializationNumber<ColumnArray::Offset> through the #96563 pool, on a line this commit does not touch
2 💡 The commit message says #96563 "made the constructors private" AGREE, noted Accurate for SerializationArray; SerializationNumber's constructor became protected. Both non-public, and the load-bearing claim (26.3 has no create at all, hence the three errors at line 61) is exact. Left as written rather than spending a round on one word
3 💡 Three absolute-offsets carriers were not enumerated in the plan AGREE, noted All three are correct to leave alone, measured rather than argued: the substreams cache is written only after verification and stores sizes, so read-back accumulation is monotonic by construction; the caller set of the static offsets readers, including both SerializationObjectSharedData sites, is identical to 26.6's; SerializationArrayOffsets differs from 26.6 only by the #96563 pool helpers. Per-file counts of position_independent_encoding = false match 26.6 file by file, so no reader is exposed on 26.3 that is not already exposed where this backport merged green

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Session id: cron:clickhouse-review-slot-11:20260910-150500

@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [3b610e3]

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @CurtizJ, could you review this? It is the 26.3 leg of #109212, carrying the same two files as the robot branch you adapted at f5e115bf, with that same single line changed from SerializationArray::create to std::make_shared because 26.3 predates the #96563 serialization pool. I opened it as a PR against 26.3 rather than pushing there because that branch's head also deleted 4033 files, so it can neither merge nor trigger a workflow.

@pufit pufit closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants