Skip to content

v3.7.1: Backport brotli CVE-2026-111497 patch to release-3.7 (#927)

Choose a tag to compare

@sfc-gh-okalaci sfc-gh-okalaci released this 23 Nov 13:04
· 26 commits to release-3.7 since this release
46c3eee
* duckdb_pglake: patch vendored brotli to 1.1.1 for CVE-2026-111497

DuckDB v1.5.6 vendors the brotli 1.1.0 decoder, which Parquet uses
for BROTLI-compressed pages. Brotli 1.0.3 through 1.2.0 have an
out-of-bounds write in the decoder. A crafted stream that declares a
single block type and runs out its block length forces a block switch
that cannot happen. The fast path ignores the failure and keeps
decoding with stale block state.

DuckDB main and v1.5-variegata still carry 1.1.0, so there is no
DuckDB version to bump to. This patch applies the upstream 1.1.1
backport (google/brotli da98063, from 0ed4268 on master) to the
vendored copy. DecodeBlockTypeAndLength now returns an error code, so
a format error stops decoding on both the safe and fast paths with
the new BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH (-17). The version
and ABI revision move to 1.1.1 to match upstream.

Drop this patch once DuckDB ships a release with brotli 1.1.1 or
1.2.1 or later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit dbfd37f547a6413127b7f37d21887666beadfdf1)
Signed-off-by: Önder Kalacı <oender.kalaci@snowflake.com>

* duckdb_pglake: add brotli regression test run by check-duckdb_pglake

The patch now also adds a Catch test that feeds the crafted stream to the
decoder and requires BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH. make
check-duckdb_pglake applies the patch to the duckdb submodule, builds the
test against the vendored brotli, runs it, and restores the checkout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit 99d9bc54df1cca1fc250a17b8be9cd60a927411a)
Signed-off-by: Önder Kalacı <oender.kalaci@snowflake.com>

* duckdb_pglake: keep the brotli test out of DuckDB's unittest build

The patch added test_brotli_invalid_block_switch.cpp to test/common's
CMakeLists, so the regular DuckDB build compiled it into unittest, where
brotli/decode.h is not on the include path. make check-duckdb_pglake
already builds and runs the test on its own against the vendored
brotli, so drop the CMakeLists hunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit 3800ab3fe72dba3676e3d7d92a0d3e5ff27210c9)
Signed-off-by: Önder Kalacı <oender.kalaci@snowflake.com>

* check-duckdb_pglake: initialize the duckdb submodule first

CI test jobs check out pg_lake without submodules, so duckdb_pglake/duckdb
is empty there and git -C falls through to the parent repository. Fetch
just the duckdb submodule, shallow, before patching it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit 360c03c84249244d29d21486b0fc61d99d31d62d)
Signed-off-by: Önder Kalacı <oender.kalaci@snowflake.com>

---------

Signed-off-by: Önder Kalacı <oender.kalaci@snowflake.com>