From 1f50a8cf7cce96c3b2b67343dc57ca17854c0094 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 25 Jun 2020 11:35:49 +0200 Subject: [PATCH] nihav_core/deflate: recognize deflated stream header in uncompress() --- nihav-core/src/compr/deflate.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) } } -- 2.39.5