Expand description
webpsan is a WebP format “sanitizer”.
The sanitizer currently simply checks the validity of a WebP file input, so that passing a malformed filed to an unsafe parser can be avoided.
§Usage
The main entry points to the sanitizer is sanitize, which take a Read + Skip input. The Skip trait
represents a subset of the Seek trait; an input stream which can be skipped forward, but not necessarily seeked
to arbitrary positions.
let example_input = b"RIFF\x14\0\0\0WEBPVP8L\x08\0\0\0\x2f\0\0\0\0\x88\x88\x08";
webpsan::sanitize(std::io::Cursor::new(example_input))?;The parse module also contains a less stable and undocumented API which can be used to parse individual WebP
chunk types.
Modules§
- parse
- Unstable API for parsing WebP files.
Structs§
- Config
- Configuration for the WebP sanitizer.
- Config
Builder - Builder for
Config. - Report
- A report with additional debugging info for an error.
- Seek
Skip Adapter - An adapter implementing
Skip/AsyncSkipfor all types implementing [Seek]/[AsyncSeek].
Enums§
- Config
Builder Error - Error type for ConfigBuilder
Constants§
- MAX_
FILE_ LEN - Maximum file length as permitted by WebP.
Traits§
- Skip
- A subset of the [
Seek] trait, providing a cursor which can skip forward within a stream of bytes.
Functions§
- sanitize
- Sanitize a WebP input.
- sanitize_
with_ config - Sanitize a WebP input, with the given
Config.
Type Aliases§
- Error
- Error type returned by
webpsan.