Merge pull request #5274 from chipitsine/master

libfreerdp/codec/include/bitmap.c: resolve possible NULL pointer arithmetic
This commit is contained in:
akallabeth 2019-02-22 13:43:10 +01:00 committed by GitHub
commit 1b0ed37dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,8 +92,8 @@ static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
UINT32 rowDelta, UINT32 width, UINT32 height)
{
const BYTE* pbSrc = pbSrcBuffer;
const BYTE* pbEnd = pbSrcBuffer + cbSrcBuffer;
const BYTE* pbDestEnd = pbDestBuffer + rowDelta * height;
const BYTE* pbEnd;
const BYTE* pbDestEnd;
BYTE* pbDest = pbDestBuffer;
PIXEL temp;
PIXEL fgPel = WHITE_PIXEL;
@ -112,6 +112,9 @@ static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
if (!pbSrcBuffer || !pbDestBuffer)
return FALSE;
pbEnd = pbSrcBuffer + cbSrcBuffer;
pbDestEnd = pbDestBuffer + rowDelta * height;
while (pbSrc < pbEnd)
{
/* Watch out for the end of the first scanline. */