Skip to main content

block_original_size

Function block_original_size 

Source
pub fn block_original_size(block: &Block) -> Result<usize>
Expand description

Decompressed size of block, rejected when it exceeds any plausible block size.

Both zstd and the dictionary path size their output buffer from this, so an unchecked value is an allocation an attacker chooses. The bound is deliberately absolute rather than a compression ratio: real content reaches extreme ratios, a run of zeroes compressing by four orders of magnitude, and a ratio test rejects those legitimate packages.