From a0630dee07ecf3f84686eb5f77b126fd45f9f457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 11 May 2016 16:35:20 -0400 Subject: [PATCH] libfreerdp-codec: fix xcrush context flush --- libfreerdp/codec/xcrush.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libfreerdp/codec/xcrush.c b/libfreerdp/codec/xcrush.c index 650ab3b30..08b44de4a 100644 --- a/libfreerdp/codec/xcrush.c +++ b/libfreerdp/codec/xcrush.c @@ -816,19 +816,26 @@ int xcrush_decompress(XCRUSH_CONTEXT* xcrush, BYTE* pSrcData, UINT32 SrcSize, BY pSrcData += 2; SrcSize -= 2; - if (Level2ComprFlags & PACKET_COMPRESSED) - { - status = mppc_decompress(xcrush->mppc, pSrcData, SrcSize, &pDstData, &DstSize, Level2ComprFlags); - - if (status < 0) - return status; - } - else + if (!(Level2ComprFlags & PACKET_COMPRESSED)) { pDstData = pSrcData; DstSize = SrcSize; + + status = xcrush_decompress_l1(xcrush, pDstData, DstSize, ppDstData, pDstSize, Level1ComprFlags); + + return status; } + if (Level2ComprFlags & PACKET_FLUSHED) + { + xcrush_context_reset(xcrush, FALSE); + } + + status = mppc_decompress(xcrush->mppc, pSrcData, SrcSize, &pDstData, &DstSize, Level2ComprFlags); + + if (status < 0) + return status; + status = xcrush_decompress_l1(xcrush, pDstData, DstSize, ppDstData, pDstSize, Level1ComprFlags); return status;