Skip to content

Cherry pick #104751 to 26.4: Fix use-after-free in AvroConfluentRowInputFormat#104847

Merged
robot-clickhouse-ci-1 merged 6 commits into
backport/26.4/104751from
cherrypick/26.4/104751
May 13, 2026
Merged

Cherry pick #104751 to 26.4: Fix use-after-free in AvroConfluentRowInputFormat#104847
robot-clickhouse-ci-1 merged 6 commits into
backport/26.4/104751from
cherrypick/26.4/104751

Conversation

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor

Original pull-request #104751

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

mstetsyuk and others added 6 commits May 12, 2026 19:28
`AvroConfluentRowInputFormat::getOrCreateDeserializer` built an
`AvroDeserializer` on the stack and copied it into `deserializer_cache`.
The deserializer holds `symbolic_skip_fn_map`, and skip lambdas in its
action tree capture references into that map. Copying deep-copies the
map to a new address while the lambdas still reference the original;
once the stack local is destroyed those references dangle, and the next
row deserialization invokes a `std::function` over freed memory.

Move into the cache instead of copying. `std::map` move-construction
transfers existing nodes without relocating them, so the captured
references remain valid.
Prevent reintroduction of the use-after-free fixed in the previous commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous schema's symbolic reference sat at the top level of a
skipped field, so createAction resolved it before createSkipFn was
called, never building the reference-capturing lambda.

A recursive Node schema with `next: ["null", "Node"]` puts the
symbolic node inside a union branch, which is one of the spots
createSkipFn recurses into on its own.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lizer-copy

Fix use-after-free in `AvroConfluentRowInputFormat`
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 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 May 13, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 merged commit b1620f3 into backport/26.4/104751 May 13, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 deleted the cherrypick/26.4/104751 branch May 13, 2026 13:03
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