mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
This is the first milestone of a byte-exact rewrite of brotli (reference implementation tag v1.2.1) in Wuffs. The decoder mirrors c/dec/decode.c function by function, including its validation checks: the same output for valid input and the same verdict, with each BROTLI_DECODER_ERROR_FORMAT_* code mapped to a Wuffs status (see std/brotli/README.md). The C state machine is replaced by Wuffs coroutines, so decoding works with arbitrarily small src and dst buffers. The history window lives in the caller's workbuf. Huffman table groups, context maps and the static dictionary scratch space live in the decoder struct. The static dictionary, transforms, context lookup tables and prefix code tables in common_tables.wuffs are generated from the brotli source by script/print-brotli-tables.go. Tests: golden tests on the upstream tests/testdata vectors and on streams produced by the v1.2.1 CLI at several qualities and window sizes, 1-byte I/O limits, truncation at every prefix, malformed inputs per error code, trailing data and workbuf boundaries. With -mimic, every vector and every malformed input is also compared against libbrotlidec, including the exact error code. A differential run over about a million mutated inputs found no divergence. Not yet supported (left as TODOs): large-window brotli, custom/shared dictionaries, metadata callbacks and fast paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
1 line
843 B
Plaintext
1 line
843 B
Plaintext
znxcvnmz,xvnm.,zxcnv.,xcn.z,vn.zvn.zxcvn.,zxcn.vn.v,znm.,vnzx.,vnzxc.vn.z,vnz.,nv.z,nvmzxc,nvzxcvcnm.,vczxvnzxcnvmxc.zmcnvzm.,nvmc,nzxmc,vn.mnnmzxc,vnxcnmv,znvzxcnmv,.xcnvm,zxcnzxv.zx,qweryweurqioweupropqwutioweupqrioweutiopweuriopweuriopqwurioputiopqwuriowuqerioupqweropuweropqwurweuqriopuropqwuriopuqwriopuqweopruioqweurqweuriouqweopruioupqiytioqtyiowtyqptypryoqweutioioqtweqruowqeytiowquiourowetyoqwupiotweuqiorweuqroipituqwiorqwtioweuriouytuioerytuioweryuitoweytuiweyuityeruirtyuqriqweuropqweiruioqweurioqwuerioqwyuituierwotueryuiotweyrtuiwertyioweryrueioqptyioruyiopqwtjkasdfhlafhlasdhfjklashjkfhasjklfhklasjdfhklasdhfjkalsdhfklasdhjkflahsjdkfhklasfhjkasdfhasfjkasdhfklsdhalghhaf;hdklasfhjklashjklfasdhfasdjklfhsdjklafsd;hkldadfjjklasdhfjasddfjklfhakjklasdjfkl;asdjfasfljasdfhjklasdfhjkaghjkashf;djfklasdjfkljasdklfjklasdjfkljasdfkljaklfj |