Skip to content

Cherry pick #115222 to 26.5: Bound text index posting list deserialization - #116309

Merged
robot-clickhouse-ci-2 merged 3 commits into
backport/26.5/115222from
cherrypick/26.5/115222
Aug 26, 2026
Merged

robot-clickhouse-ci-2 merged 3 commits into
backport/26.5/115222from
cherrypick/26.5/115222

Conversation

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Original pull-request #115222

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

CurtizJ and others added 2 commits August 17, 2026 22:54
`PostingListCodecNone::decode` handed the payload to `PostingList::read`, which
wraps `roaring_bitmap_portable_deserialize` and trusts the container headers
found inside that payload. A container claiming more values than the declared
size holds made the deserializer read past the end of the buffer and return the
leaked bytes as row ids, so a corrupted or forged text index file - for example
one delivered by `RESTORE TABLE` - turned into a heap out-of-bounds read of up
to ~24 KiB per query.

Use `PostingList::readSafe`, which bounds every container read by the declared
size, as `DeleteBitmap`, `AggregateFunctionGroupBitmapData` and
`PuffinBlockInputFormat` already do. It is free: croaring's `read` is
`readSafe` with `maxbytes = SIZE_MAX`.

ClickHouse/clickhouse-private#69184

Co-Authored-By: Claude Opus 5 <[email protected]>
Bound text index posting list deserialization
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Aug 25, 2026
In 26.5 an uncompressed posting list is deserialized inline in
`PostingsSerialization::deserialize` instead of in
`PostingListCodecNone::decode`, so both of its call sites read the
bitmap with `readSafe` now. The unit test is adapted to that interface
and covers the in-place and the copying path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants