Skip to content

Backport #115702 to 26.7: Fix integer overflow in String deserialization - #118201

Merged
clickhouse-gh[bot] merged 3 commits into
26.7from
backport/26.7/115702
Sep 5, 2026
Merged

clickhouse-gh[bot] merged 3 commits into
26.7from
backport/26.7/115702

Conversation

@robot-clickhouse-ci-2

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #115702
Cherry-pick pull-request #118148

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.7.7.30

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix labels Sep 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [66409ab]

Summary: ✅

alexey-milovidov and others added 2 commits September 5, 2026 08:07
In 26.7, `deserializeBinaryBulkWithMultipleStreams` takes a `ColumnPtr &` rather than an `IColumn &`, so the helper in `gtest_string_serialization.cpp` has to hold the result as a `ColumnPtr`, as the other tests in the file already do. This fixes the build failure of the backport:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=118201&sha=0fc2e6e46d73a58902464e1125d897a8e7acf479&name_0=BackportPR&name_1=Build%20%28amd_debug%29
#118201

Co-Authored-By: Claude Fable 5.1 <[email protected]>
alexey-milovidov added a commit that referenced this pull request Sep 5, 2026
…ix the test signature

The 26.6 branch still has the `rows_offset` parameter of
`deserializeBinaryBulkWithMultipleStreams` (removed on master), so the
backported `gtest_string_serialization.cpp` did not compile (five arguments
where six are expected). Port the same branch-only adaptation as the 26.7
twin (#118201):

- `deserializeBinaryBulkWithSizeStream`: accumulate the sizes of the rows
  skipped by `rows_offset` in 128 bits and reject a sum above
  `MAX_TOTAL_STRING_SIZE` with `INCORRECT_DATA`, as the skipped prefix comes
  from the same untrusted sizes stream and an unchecked `size_t` sum could wrap
  and make `ignore` skip a wrong number of bytes.
- `expectSizesStreamRejected` takes `rows_offset`, holds the result as a
  `ColumnPtr` (the branch signature takes `ColumnPtr &`), and a new test
  `WithSizeStreamHugeSkippedSizeIsRejected` covers the skipped-prefix path.

CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=118200&sha=5bb0496be03bc66420b1316da678c4c25350ec6d&name_0=BackportPR&name_1=Build%20%28amd_debug%29
PR: #118200
alexey-milovidov added a commit that referenced this pull request Sep 5, 2026
Port the same branch-only adaptation as the 26.6 and 26.7 twins
(#118200,
#118201), as requested in the
review of this PR:

- `deserializeBinaryBulkWithSizeStream`: accumulate the sizes of the rows
  skipped by `rows_offset` in 128 bits and reject a sum above
  `MAX_TOTAL_STRING_SIZE` with `INCORRECT_DATA`. The skipped prefix comes from
  the same untrusted sizes stream, so an unchecked `size_t` sum could wrap and
  make `ignore` skip a wrong number of bytes, yielding silently wrong string
  data instead of a rejection.
- `expectSizesStreamRejected` takes `rows_offset`, and the new gtest
  `WithSizeStreamHugeSkippedSizeIsRejected` covers the skipped-prefix path.

PR: #118199

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh
clickhouse-gh Bot merged commit 668b83e into 26.7 Sep 5, 2026
38 of 39 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.7/115702 branch September 5, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants