Skip to main content

snappy_decompress_limited

Function snappy_decompress_limited 

Source
pub(crate) async fn snappy_decompress_limited(
    buf: &[u8],
    max_decompressed: usize,
    limiter: &ServerMemoryLimiter,
) -> Result<ChargedBuffer>
Expand description

Decompresses a raw Snappy body after enforcing a hard cap on the decoded size and charging the aggregate request-memory limiter.

The raw Snappy format prefixes the stream with a varint of the decoded length, so the output size is known (and validated) before the output buffer is allocated by decompress_vec.