Memory-Safe WebP Decoding
Halide released wpd, a memory-safe WebP decoder written in Rust that outperforms libwebp while maintaining full feature parity.
summary is enough The article outlines the security rationale and performance benchmarks for a new Rust WebP decoder, but technical readers can grasp the core claims without reading the full blog post.
summary
Halide released wpd, an open-source, memory-safe WebP decoder written in Rust designed to mitigate vulnerabilities like CVE-2023-4863. Unlike other safe alternatives, wpd matches or exceeds libwebp's feature set while achieving up to 3x faster performance through algorithmic improvements and optional handwritten SIMD routines. Developers can compile it without SIMD for a strictly verified memory-safe environment. The project aims to provide a drop-in replacement for insecure C-based decoders across consumer applications.
key points
- Written primarily in Rust with optional handwritten SIMD routines, wpd offers a fallback mode that compiles entirely without unsafe code outside of vetted crates.
- Benchmarks show wpd is up to 1.19x faster for single-threaded lossy and over 3x faster for multi-threaded lossless decoding compared to libwebp.
- It achieves broad feature parity with libwebp, supporting complex animations, raw subframe decoding, and various output color formats.
who should read it
Systems and Rust developers looking for secure, high-performance media parsing libraries.
discussion positive
consensus
Commenters discuss alternative memory-safe parsers like Google's Wuffs, noting that while Wuffs is catching up on WebP and SIMD support, wpd currently offers superior performance and feature parity.
pushback
A commenter notes that wpd's development relied heavily on AI tools like Claude, raising questions about code maintenance and handling of edge cases.
Wuffs author here.
We got a pull request (https://github.com/google/wuffs/pull/168) in February to add lossy WebP support. Lossless WebP (which in some sense is an entirely different format, just reusing the WebP "brand") has had a Wuffs implementation for a couple of years now.
Anyway, the PR included SIMD acceleration and performance was on par with libwebp (C code).
The PR's code was, as far as I could tell, somewhat or mostly AI assisted. While that's great in terms of features, I still have more confidence in hand-crafted code.
I have since been working to manually rewrite the PR. …
The author of Google's Wuffs project provides context on their own competing safe WebP decoder and its current status regarding SIMD and animation support.
Generated by an LLM from the article and thread. Check the sources before relying on it.