Repository navigation
Conversation
Resolves the 26.6 cherry-pick of ClickHouse#115222. The production change is the same bound that merged upstream: `PostingList::read` becomes `PostingList::readSafe(..., num_bytes)` at both `PostingsSerialization::deserialize` sites in `MergeTreeIndexText.cpp`, the in-place one and the `deserialization_buffer` one. The unit test the automated backport carries aborts, which is why `Unit tests (asan_ubsan)` and `Unit tests (tsan)` are red on ClickHouse#116535 and write no result file. `PostingsSerialization`'s constructor asserts that its codec is non-null (`MergeTreeIndexText.cpp:152`), and the release-branch rewrite of `gtest_text_index_postings_deserialization.cpp` constructs it with `nullptr`, on the stated assumption that a posting list without the `IsCompressed` flag never consults the codec. That holds for `deserialize`, but the constructor asserts first, so `TextIndexPostingsDeserializationTest.RoundTrip` aborted before `deserialize` was entered and `TruncatedPayloadRejected` never ran at all. This passes a `PostingListCodecNone` instead, which is what production does in the same situation: `TextIndexUtils.cpp` maps an absent codec to a real `None` codec through `PostingListCodecFactory` rather than passing null. `master` is unaffected because its version of this test uses `PostingListCodecNone` directly and never constructs `PostingsSerialization`. Validated on this branch: the test aborts before the change; both `RoundTrip` and `TruncatedPayloadRejected` pass after it; and with the bound reverted to `PostingList::read`, `TruncatedPayloadRejected` fails at all four of its assertions, so the test does cover the bound this backport exists for. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review (click to expand)An independent cold review of this diff plus a second-model gate pass, both run before publication. Gate: one blocker raised, and I disagree with it. Recorded rather than quietly dropped. ❌ The gate argues that a corrupted oversized I checked every step and the mechanism holds, so I am not disputing it. I am disputing that it belongs
Own review: no blocker, no major. Three things checked that could each have been a finding:
One thing worth noting for anyone comparing this test against |
|
Workflow [BackportPR], commit [9f0f6af] Summary: ❌
|
Pre-PR validation gate (click to expand)
Mutation check (beyond the gate): with the backported bound reverted to Session id: cron:clickhouse-impl-slot-6:20260827-025400 |
|
cc @Ergus, could you review this? It is the 26.6 backport of #115222 with the unit test it ships fixed: the release-branch rewrite built |
CI finish ledger - 9f0f6afCI is fully finished at this commit: 38
The gtest this PR exists to fix is green here: the two Session id: cron:our-pr-ci-monitor:20260827-073000 |
Fixing-PR links for the two Kafka reds on this ledgerThe ledger above promised the fixing-PR link for the slow-test half. It exists and is merged.
The slow-test half is verified, not just merged. Counting both backport-PR runs and the The fast half is still open, and That tree carries the slow-test hunk and not the fast one, and in the same run the slow test One observation for whoever picks #113975 up. It is
Session id: cron:clickhouse-plan-slot-33:20260902-205626 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed an out-of-bounds read while deserializing corrupted posting lists of a text index.
Description
Related: #115222
Related: #116535
Requested by @ CurtizJ on #116535: #116535 (comment)
The 26.6 backport of #115222, on top of current
26.6, with the unit test it ships fixed.Unit tests (asan_ubsan)andUnit tests (tsan)fail on #116535 becauseunit_tests_dbmsaborts, so the job writes no result file at all.PostingsSerialization's constructor asserts that its codec is non-null (MergeTreeIndexText.cpp:152), and the version of the test rewritten for the release branches passesnullptr. That is safe as far asdeserializegoes, which never consults the codec for an uncompressed posting list, but the constructor asserts first:RoundTripaborted beforedeserializewas entered, andTruncatedPayloadRejectednever ran. The fix passes aPostingListCodecNone, which is whatTextIndexUtils.cppalready does when no codec is configured.masteris unaffected because its version of the test never constructsPostingsSerialization.Validated on this branch with a Debug build:
RoundTripaborts in that constructor before the change, and bothRoundTripandTruncatedPayloadRejectedpass after it, over five repeats. With the backportedPostingList::readSafebound reverted toPostingList::read,TruncatedPayloadRejectedfails at all four of its assertions whileRoundTripstays green, so the test does cover the bound this backport exists for.This supersedes #116535. Basing it on
backport/26.6/115222instead would be a stacked pull request, which the rulebook forbids and which draws no checks, and I have no push access to that branch. Closing #116535 is yours to decide; the one-line patch is in that thread if you would rather apply it there.26.3 and 26.5 already carry this test merged but never executed, since neither branch runs a
Unit testsjob.