Crate webpsan

Source
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.
ConfigBuilder
Builder for Config.
Report
A report with additional debugging info for an error.
SeekSkipAdapter
An adapter implementing Skip/AsyncSkip for all types implementing [Seek]/[AsyncSeek].

Enums§

ConfigBuilderError
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.