From bb06376057526d233663fd03320b4e4d3d8dc577 Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Tue, 4 Dec 2018 21:02:15 +0100 Subject: [PATCH] Fix decompression of skippable zstd frames --- CPP/7zip/Compress/ZstdDecoder.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CPP/7zip/Compress/ZstdDecoder.cpp b/CPP/7zip/Compress/ZstdDecoder.cpp index 03ee13e4..d08ec9bc 100644 --- a/CPP/7zip/Compress/ZstdDecoder.cpp +++ b/CPP/7zip/Compress/ZstdDecoder.cpp @@ -37,6 +37,11 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size) { DProps *pProps = (DProps *)prop; +#if DEBUG + printf("prop size =%u\n", size); + fflush(stdout); +#endif + switch (size) { case 3: memcpy(&_props, pProps, 3); @@ -133,6 +138,10 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream, if (zIn.pos == zIn.size) break; + /* end of frame, but more data there... */ + if (result == 0 && zIn.pos != zIn.size) + continue; + /* end of frame */ if (result == 0) { result = ZSTD_resetDStream(_ctx);