From: Kostya Shishkov Date: Thu, 25 Jun 2020 09:35:49 +0000 (+0200) Subject: nihav_core/deflate: recognize deflated stream header in uncompress() X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=1f50a8cf7cce96c3b2b67343dc57ca17854c0094;p=nihav.git nihav_core/deflate: recognize deflated stream header in uncompress() --- diff --git a/nihav-core/src/compr/deflate.rs b/nihav-core/src/compr/deflate.rs index 89e8b68..fa318a4 100644 --- a/nihav-core/src/compr/deflate.rs +++ b/nihav-core/src/compr/deflate.rs @@ -716,7 +716,8 @@ impl Inflate { ///! Decompresses input data into output returning the uncompressed data length. pub fn uncompress(src: &[u8], dst: &mut [u8]) -> DecompressResult { let mut inflate = Self::new(); - inflate.decompress_data(src, dst, false) + let off = if src.len() > 2 && src[0] == 0x78 && src[1] == 0x9C { 2 } else { 0 }; + inflate.decompress_data(&src[off..], dst, false) } }