Skip to content

Cherry pick #115701 to 25.8: Validate aggregate function states on deserialization - #116349

Merged
robot-ch-test-poll4 merged 7 commits into
backport/25.8/115701from
cherrypick/25.8/115701
Aug 27, 2026
Merged

robot-ch-test-poll4 merged 7 commits into
backport/25.8/115701from
cherrypick/25.8/115701

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

Original pull-request #115701

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

alexey-milovidov and others added 6 commits August 21, 2026 02:42
…rd `Resample` state sizes

Address review: the `Momentum`, `Nesterov` and `Adam` weights updaters deserialize their
vectors from the data without checking them against the number of weights, so a crafted
state could make `merge` or `addToBatch` read past the end of a vector. Pass the expected
size (the gradient size, i.e. the number of weights plus one for the bias) into
`IWeightsUpdater::read` and reject mismatched vectors with `INCORRECT_DATA`. An empty
vector stays valid, because versions before 23.2 serialized the vectors empty until the
first update; guard `Momentum::merge` and `Nesterov::merge` against an empty rhs as well.

Also cut off absurdly large `Resample` combinator states: nested combinators can produce
a state size that avoids the multiplication overflow check but still reaches the allocator
sanity limit of 2^63 bytes, which is reported as a logical error. Found by the AST fuzzer:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115701&sha=7ba562b7636f1a8219850caaaed32d51ba64519f&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
#115701

Co-Authored-By: Claude Fable 5 <[email protected]>
…alization-bounds

Validate aggregate function states on deserialization
@robot-clickhouse robot-clickhouse 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-critical-bugfix labels Aug 25, 2026
…ypick/25.8/115701

# Conflicts:
#	src/AggregateFunctions/KeyHolderHelpers.h
@robot-ch-test-poll4
robot-ch-test-poll4 merged commit a964b19 into backport/25.8/115701 Aug 27, 2026
1 check passed
@robot-ch-test-poll4
robot-ch-test-poll4 deleted the cherrypick/25.8/115701 branch August 27, 2026 17:44
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-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants