Skip to content

Cherry pick #127419 to 26.3: Bump brotli from v1.2.0 to v1.2.1 - #127775

Merged
robot-clickhouse-ci-2 merged 6 commits into
backport/26.3/127419from
cherrypick/26.3/127419
Oct 26, 2026
Merged

robot-clickhouse-ci-2 merged 6 commits into
backport/26.3/127419from
cherrypick/26.3/127419

Conversation

@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor

Original pull-request #127419

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.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

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

actueleai and others added 5 commits October 22, 2026 13:59
Update `brotli` to the upstream release `v1.2.1`, which fixes
CVE-2026-111497: an out-of-bounds write in the decoder that permits remote
code execution.

The pin stays on the `ClickHouse/brotli` fork, branch `ClickHouse/v1.2.1`
(head `2d9c9b61f4e7`), which is upstream `v1.2.1` plus the single carried
ClickHouse patch `disable BROTLI_MODEL macro for some targets` (the
loongarch64 fix). The patch rebased onto `v1.2.1` without conflicts, and
`.gitmodules` already names the fork, so it is unchanged.

Upstream changes in the decoder, all internal to `c/dec/decode.c`: the
block-switch helpers now return a `BrotliDecoderErrorCode` instead of a
boolean, so a malformed block switch is reported as the new
`BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH` (-17, previously reserved)
rather than being treated as a truncated stream. The public C API is
otherwise unchanged; `BROTLI_VERSION_PATCH` and `BROTLI_ABI_REVISION` move
to 1.

No ClickHouse-side build adaptation was needed: no source file was added,
removed or renamed, and `contrib/brotli-cmake/CMakeLists.txt` still lists
exactly the `*.c` files under `c/common`, `c/dec` and `c/enc`.

Co-Authored-By: Claude Code <[email protected]>
The malformed stream declares one block type but attempts a block switch.
Decode it both at once and one byte at a time, and require the new
`BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH` error. The test returns -9
with v1.2.0 and -17 with v1.2.1.

Link: #127419
Source: https://github.com/nodejs/node/blob/main/test/parallel/test-zlib-invalid-input.js
Bump `brotli` from v1.2.0 to v1.2.1
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 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 Oct 25, 2026
@rschu1ze

Copy link
Copy Markdown
Member

@groeneai Resolve the merge conflicts.

Merge backport/26.3/127419 into cherrypick/26.3/127419. The only conflict is
the contrib/brotli submodule: 26.3 pins brotli v1.0.9 (d224526f8fa7), while
master moved v1.2.0 -> v1.2.1. Take the master pin 2d9c9b61f4e7 (the
ClickHouse fork of v1.2.1) and master's contrib/brotli-cmake/CMakeLists.txt
source list from #119096 (v1.0.9 -> v1.2.0), without which v1.2.x does not
link. src/CMakeLists.txt and the new gtest merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator

Resolved. The only conflict is the contrib/brotli submodule: 26.3 is still on brotli v1.0.9 (d224526f8fa7), because the v1.0.9 -> v1.2.0 bump #119096 was never backported. The resolution takes master's pin 2d9c9b61f4e7 (v1.2.1) together with master's contrib/brotli-cmake/CMakeLists.txt from #119096, which v1.2.x needs in order to link. src/CMakeLists.txt and the gtest merge cleanly. Against backport/26.3/127419 the merge changes exactly those four paths, each identical to master's version except src/CMakeLists.txt, where the same 4 lines land in 26.3's unit_tests_dbms block.

Worth knowing before merging: this also brings the v1.2.0 encoder to 26.3, so brotli-compressed output is no longer byte-identical to earlier 26.3 releases (decoding is compatible both ways, per #119096).

Validated on the 26.3 tree with clang-21 (26.3's pinned compiler), debug build: unit_tests_dbms and clickhouse build, BrotliDecoder.RejectInvalidBlockSwitch passes, and a 1M-row round trip through a .br file and a brotli-compressed Parquet file returns the same checksums. Without the bump the gtest would fail: built against the v1.0.9 sources, the decoder rejects that stream with -9 (FORMAT_BLOCK_LENGTH_1), not -17.

I can't push to this repository. The merge is on my fork and its first parent is this PR's head, so applying it is a fast-forward:

git fetch https://github.com/groeneai/ClickHouse groeneai/resolve-26.3-cherrypick-127419
git push origin FETCH_HEAD:cherrypick/26.3/127419

(resolved head bc3a1922366626c696f93fb91867ccbab0b89425)

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Applied the conflict resolution prepared by @groeneai (fast-forward to bc3a1922366). I checked that it is a two-parent merge of this PR's head and the current backport/26.3/127419. Against the base it changes exactly contrib/brotli (now pinned to master's v1.2.1 2d9c9b61f4e7), contrib/brotli-cmake/CMakeLists.txt (identical to master), src/CMakeLists.txt and the new gtest. I also checked that every source file listed in the new brotli-cmake list exists in that brotli commit. Note: this effectively backports the v1.0.9 -> v1.2.x bump (#119096) to 26.3 as well, so brotli-compressed output is no longer byte-identical to earlier 26.3 releases. Whether to accept that for a release branch is a reviewer decision.

@robot-clickhouse-ci-2
robot-clickhouse-ci-2 merged commit d1f3156 into backport/26.3/127419 Oct 26, 2026
1 check passed
@robot-clickhouse-ci-2
robot-clickhouse-ci-2 deleted the cherrypick/26.3/127419 branch October 26, 2026 04:13
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.

6 participants