hn.today

Towards formal verification: mbrotli and mzstd

m-compressors.github.io7 points2 comments
Screenshot of Towards formal verification: mbrotli and mzstd

mbrotli and mzstd are Rust implementations of Brotli and Zstandard whose developers are adding machine-checked proofs that selected functions follow RFC 7932 and RFC 8878. Differential testing against the C libraries, fuzzing, Miri and AddressSanitizer can show agreement with those libraries and help detect memory errors, but cannot establish standards compliance: both implementations may share a mistake. CVE-2026-111497 exposed that gap. The C Brotli decoder ignored a failed block switch, and mbrotli 0.5.16 likewise accepted streams the RFC declares invalid, though safe Rust prevented memory corruption. Version 0.5.17 fixed the deviation.

The proofs use Charon to extract Rust MIR and Aeneas to translate it into Lean 4; theorems then connect the translated functions to a hand-transcribed RFC specification. CI checks that translations stay synchronized with the Rust code. Early results cover mbrotli’s distance and length codes, last-distance ring and command packing, plus mzstd’s frame and block headers, sequence counts, code tables, repeat offsets and FSE states. They establish conformance, encoder-decoder round trips and, for covered inputs, absence of panics or overflow. These are substantial but partial proofs, not verified codecs: bit readers and writers, Huffman and FSE machinery, dictionaries, a Lean reference decoder and a proof that the Rust decoder refines it remain. The work also relies on assumptions about the translation tools and RFC transcription; byte-for-byte agreement with C and SIMD code remain matters for testing.

Read on m-compressors.github.io2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.