nihav_core/deflate: recognize deflated stream header in uncompress()
[nihav.git] / nihav-core / src / compr / deflate.rs
index 89e8b6874ea4ae71005f8130fd92818697bb76eb..fa318a473e84647e9ca281cfa6fc868c243c812a 100644 (file)
@@ -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<usize> {
         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)
     }
 }