From 4c491b5a18e53cce292c26e7a50021a8217c985c Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 18 Sep 2018 09:51:50 +0200 Subject: [PATCH] Fixed #4857: Properly reset clear codec. --- libfreerdp/codec/clear.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libfreerdp/codec/clear.c b/libfreerdp/codec/clear.c index 876e8dd43..6f9969507 100644 --- a/libfreerdp/codec/clear.c +++ b/libfreerdp/codec/clear.c @@ -259,7 +259,7 @@ static BOOL clear_decompress_subcode_rlex(wStream* s, for (i = 0; i < runLengthFactor; i++) { BYTE* pTmpData = &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + - (nYDstRel + y) * nDstStep]; + (nYDstRel + y) * nDstStep]; if ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight)) WriteColor(pTmpData, DstFormat, color); @@ -284,7 +284,7 @@ static BOOL clear_decompress_subcode_rlex(wStream* s, for (i = 0; i <= suiteDepth; i++) { BYTE* pTmpData = &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + - (nYDstRel + y) * nDstStep]; + (nYDstRel + y) * nDstStep]; UINT32 color = palette[suiteIndex]; if (suiteIndex > 127) @@ -834,7 +834,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, count = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0; pSrcPixel = &vBarShortEntry->pixels[(y - vBarYOn) * GetBytesPerPixel( - clear->format)]; + clear->format)]; for (x = 0; x < count; x++) { @@ -886,10 +886,10 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, for (y = 0; y < count; y++) { BYTE* pDstPixel8 = &pDstData[((nYDstRel + y) * nDstStep) + - ((nXDstRel + i) * GetBytesPerPixel(DstFormat))]; + ((nXDstRel + i) * GetBytesPerPixel(DstFormat))]; UINT32 color = ReadColor(pSrcPixel, clear->format); color = FreeRDPConvertColor(color, clear->format, - DstFormat, NULL); + DstFormat, NULL); if (!WriteColor(pDstPixel8, DstFormat, color)) return FALSE; @@ -1173,6 +1173,13 @@ BOOL clear_context_reset(CLEAR_CONTEXT* clear) return FALSE; clear->seqNumber = 0; + clear->VBarStorageCursor = 0; + clear->ShortVBarStorageCursor = 0; + + if (clear->nsc) + nsc_context_reset(clear->nsc, clear->nsc->width, clear->nsc->height); + + memset(clear->TempBuffer, 0, clear->TempSize); return TRUE; } CLEAR_CONTEXT* clear_context_new(BOOL Compressor)