Skip to main content

concinnity_core/decode/
mod.rs

1//! Bounds-checked primitives for reading bytes the process did not produce:
2//! compiled payloads loaded off disk, and the artist-supplied image files the
3//! cook pipeline imports. Both are external input, so a truncated, corrupt, or
4//! hostile buffer has to surface as an error rather than a panic.
5//!
6//! Two failure modes matter here and neither is caught by ordinary slicing:
7//! running off the end of the buffer, and size arithmetic that overflows before
8//! it is ever compared against the buffer length. A `width * height * 4` that
9//! wraps produces a small product, passes the length check that follows it, and
10//! decodes from the wrong offsets. `ByteReader` covers the first, the `size`
11//! helpers cover the second.
12
13pub mod reader;
14pub mod size;
15
16pub use reader::ByteReader;
17pub use size::checked_product;