From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "magic" |
|---|
| subject | "Library:Libbrotli" |
|---|
| claim | "When BrotliEncoderCompress's result would not fit BrotliEncoderMaxCompressedSize(n) = n + 6 + 4 x (n >> 14), it writes MakeUncompressedStream: 21 03 (WBITS 10, empty metadata block), then uncompressed meta-blocks of up to 16 MiB each (3- or 4-byte header), then 03 (empty last block). The 2-byte prefix is weak: 0x21 is the first byte of any stream with WBITS 10, and the following 03 only means an empty metadata block, which a normal encoder rarely writes there; for empty input the function writes the single byte 06 instead." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Libbrotli" |
|---|
| observed_in | |
|---|
|
|---|
| data | | bytes | "21 03" |
|---|
| offset | "0x0" |
|---|
| meaning | "stored Brotli stream written by the C encoder's one-shot fallback" |
|---|
| test_vectors | | input | "X" |
|---|
| expected | "21 03 00 00 08 58 03" |
|---|
|
| input | "hello" |
|---|
| expected | "21 03 20 00 08 68 65 6C 6C 6F 03" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "BrotliEncoderMaxCompressedSize, MakeUncompressedStream and the fallback label of BrotliEncoderCompress; present since v0.5.2" |
|---|
| repo | "https://github.com/google/brotli" |
|---|
| commit | "86ee1f65f62d6272345dee751d49e7d1f01c2b11" |
|---|
| path | "c/enc/encode.c" |
|---|
| lines | "1263-1305, 1351-1363" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "The writer of Code:Brotli/Brotli decoder and library scanner (Python) reimplements MakeUncompressedStream; its output for the vectors and for random inputs of 64 KiB, 1 MiB and 16 MiB + 5 bytes decodes back with the Python decoder" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Stored fallback stream 21 03" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T19:03:32.788Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:55:12.692Z" |
|---|
| result | "confirmed" |
|---|
| method | "Fetched c/enc/encode.c at 86ee1f65: MakeUncompressedStream writes 0x21 (window bits 10), 0x03 (empty metadata), per-chunk 3-byte header (4 bytes when nibbles==2) with chunks up to 1<<24, then 0x03; input_size 0 writes the single byte 6; BrotliEncoderMaxCompressedSize overhead = 2 + 4*(n>>14) + 3 + 1 (returns 2 for empty input); the fallback label calls it. The test vectors and the Python reimplementation were not re-run." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T11:31:42.003Z" |
|---|
| summary | "Weakness: 0x21 is simply the first byte of any WBITS 10 stream; MakeUncompressedStream emits 06 for empty input" |
|---|
| changed | |
|---|
|
|
|---|