pub struct Lz4;Expand description
Compression types 2 and 3: an LZ4 block, uncompressed as the maximum.
Trait Implementations§
Source§impl BlockCodec for Lz4
impl BlockCodec for Lz4
Source§fn decode(
&self,
input: &Bytes,
uncompressed: u32,
out: &mut DecodeBuf,
) -> Result<Decoded, Error>
fn decode( &self, input: &Bytes, uncompressed: u32, out: &mut DecodeBuf, ) -> Result<Decoded, Error>
lz4.block.decompress(data, uncompressed_size) (python-lz4 4.4.4
over liblz4 1.9.4’s LZ4_decompress_safe): a declared size above
i32::MAX is python-lz4’s OverflowError (its argument parse, so
first), and so, next, is an input above i32::MAX bytes, before
anything is reserved or read; otherwise the block is
scanned with liblz4’s exact control flow (lz4_run), which gives
its verdict and the output’s length, and only then is the output
allocated (that length, charged) and decoded. python-lz4 reserves
the whole declared size before it decodes, so where the machine
cannot reserve it UnityPy raises MemoryError and unityrs reads on
(PARITY.md section 19.3, “a count UnityPy allocates before it
reads”).