INNER CODE UNIT · Rust
MAXIMUM_ZSTD_OUTPUT_BYTES
Augani/dory · dory-core/ffi/src/lib.rs:57
const MAXIMUM_ZSTD_OUTPUT_BYTES: u64 = 256 * 1024 * 1024;
/// Result of bounded boot-artifact decompression. This record keeps malformed or oversized
/// untrusted media on the ordinary Swift error path instead of allowing an FFI panic.
#[derive(uniffi::Record)]
pub struct BoundedDecompressionResult {
pub ok: bool,
pub body: Vec<u8>,
pub error: String,
}
/// Decompress one Zstandard frame (or a standards-compliant concatenated frame stream) while
/// enforcing both a caller-selected output bound and Dory's immutable 256 MiB kernel ceiling.
/// The decoder window is capped to the same ceiling so a hostile frame cannot demand unbounded
/// history before producing output.
#[uniffi::export]
pub fn decompress_zstd_bounded(
body: Vec<u8>,