Skip to content

UPSTREAM: Detect and report invalid stream earlier. - #13940

Merged
yell0wd0g merged 1 commit into
youtube:mainfrom
jshorta:brotli-cve-2026-111497
Nov 12, 2026
Merged

yell0wd0g merged 1 commit into
youtube:mainfrom
jshorta:brotli-cve-2026-111497

Conversation

@jshorta

@jshorta jshorta commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425
Bug: 580961451

@jshorta jshorta added cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch cp-26.eap Cherry Pick to the 26.eap branch cp-27.lts Cherry Pick to the 27.lts branch labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ✅ PASS All checks passed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


net: Detect and report invalid stream earlier

Import an upstream fix for invalid block-switch handling in the Brotli
decoder. This update refactors block-type decoding functions to return
explicit error codes, allowing the decoder to identify and report
malformed streams earlier in the process.

This change addresses CVE-2026-111497.

Bug: 578287425

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Brotli decoder's block switch decoding logic to return explicit BrotliDecoderErrorCode statuses instead of simple boolean values. This includes introducing a new error code BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH (value -17) and a new helper macro BROTLI_SAFE_WITH_STATUS to handle and propagate these statuses during command processing. There are no review comments, and I have no feedback to provide.

@jshorta jshorta self-assigned this Nov 11, 2026
@jshorta jshorta removed their assignment Nov 11, 2026
@jshorta
jshorta force-pushed the brotli-cve-2026-111497 branch from 612f1a3 to a88b310 Compare November 11, 2026 23:39
@yell0wd0g
yell0wd0g merged commit f110dc6 into youtube:main Nov 12, 2026
744 of 750 checks passed
cobalt-roller-and-merger Bot pushed a commit that referenced this pull request Nov 13, 2026
…lier.

Refer to original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425

(cherry picked from commit f110dc6)
jshorta added a commit that referenced this pull request Nov 17, 2026
…lier. (#13952)

Refer to the original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425
Bug: 580961451

Co-authored-by: Jesus Horta <jshorta@google.com>
jshorta added a commit that referenced this pull request Nov 19, 2026
…lier. (#13953)

Refer to the original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425
Bug: 580961451

Co-authored-by: Jesus Horta <jshorta@google.com>
andrewsavage1 pushed a commit that referenced this pull request Nov 25, 2026
… stream earlier.

Refer to original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425

(cherry picked from commit f110dc6)
andrewsavage1 added a commit that referenced this pull request Nov 25, 2026
…tream earlier.

Staging's brotli (updated to 150.x) already contains upstream 0ed4268
(BLOCK_SWITCH error code, BROTLI_SAFE_WITH_STATUS, error-returning
block-switch decoders) in its newer form using the NextLiteralBlock label.
Resolved both conflicts in dec/decode.c by keeping staging's code. Kept the
only remaining delta: SafeDecodeDistanceBlockSwitch now returns
BrotliDecoderErrorCode instead of BROTLI_BOOL. decode.h needs no change
(BLOCK_SWITCH -17 already present).
andrewsavage1 added a commit that referenced this pull request Nov 25, 2026
… stream earlier. (#14263)

Refer to original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425

(cherry picked from commit f110dc6)


---
**Resolution** (commit `0a78938f53c`, against `autoroll-main-to-staging`
@ `0c2033df69f`):

third_party/brotli/dec/decode.c: Staging's brotli (rolled to 150.x)
already has upstream fix 0ed4268, written in its newer form that jumps
to a shared `NextLiteralBlock:` label and calls
BROTLI_SAFE_WITH_STATUS(DecodeLiteralBlockSwitch(s)). Both conflicts
were resolved by keeping staging's code. One change was still missing,
so I kept it: SafeDecodeDistanceBlockSwitch now returns
BrotliDecoderErrorCode instead of BROTLI_BOOL.
third_party/brotli/include/brotli/decode.h: no change needed, because
BLOCK_SWITCH (-17) is already there on staging. No conflict markers are
left.

**Notes:** The fix is essentially already on staging, so the net change
is a single return-type line. Since BROTLI_BOOL is an int, the old code
already passed the value through correctly, so behaviour doesn't change;
the line only fixes the type. Applying the commit is harmless, but
skipping the PR would also be fine. No build was run.

Not compiled locally; CI on the roll PR is the first build.

---------

Co-authored-by: Jesus Horta <jshorta@google.com>
Co-authored-by: Andrew Savage <andrewsavage@google.com>
cobalt-roller-and-merger Bot pushed a commit that referenced this pull request Nov 25, 2026
… stream earlier. (#14263)

Refer to original PR: #13940

Detect and report invalid stream earlier.

PiperOrigin-RevId: 876198329

(am from google/brotli@0ed4268)

Import an upstream fix for invalid block-switch handling in the Brotli
decoder (CVE-2026-111497). This update refactors block-type
decoding functions to return explicit error codes, allowing the
decoder to identify and report malformed streams earlier in the
process.

Bug: 578287425

(cherry picked from commit f110dc6)


---
**Resolution** (commit `0a78938f53c`, against `autoroll-main-to-staging`
@ `0c2033df69f`):

third_party/brotli/dec/decode.c: Staging's brotli (rolled to 150.x)
already has upstream fix 0ed4268, written in its newer form that jumps
to a shared `NextLiteralBlock:` label and calls
BROTLI_SAFE_WITH_STATUS(DecodeLiteralBlockSwitch(s)). Both conflicts
were resolved by keeping staging's code. One change was still missing,
so I kept it: SafeDecodeDistanceBlockSwitch now returns
BrotliDecoderErrorCode instead of BROTLI_BOOL.
third_party/brotli/include/brotli/decode.h: no change needed, because
BLOCK_SWITCH (-17) is already there on staging. No conflict markers are
left.

**Notes:** The fix is essentially already on staging, so the net change
is a single return-type line. Since BROTLI_BOOL is an int, the old code
already passed the value through correctly, so behaviour doesn't change;
the line only fixes the type. Applying the commit is harmless, but
skipping the PR would also be fine. No build was run.

Not compiled locally; CI on the roll PR is the first build.

---------

Co-authored-by: Jesus Horta <jshorta@google.com>
Co-authored-by: Andrew Savage <andrewsavage@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch cp-26.eap Cherry Pick to the 26.eap branch cp-27.lts Cherry Pick to the 27.lts branch

4 participants