Skip to content

Commit

Permalink
[codec,progressive] fix missing destination checks
Browse files Browse the repository at this point in the history
(cherry picked from commit ef7e0d60c207dae478952d795e74751d1516629d)
  • Loading branch information
akallabeth authored and mfleisz committed Aug 25, 2023
1 parent bdb3909 commit 23c3dae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libfreerdp/codec/progressive.c
Expand Up @@ -2422,11 +2422,17 @@ INT32 progressive_decompress_ex(PROGRESSIVE_CONTEXT* progressive, const BYTE* pS
for (j = 0; j < nbUpdateRects; j++)
{
const RECTANGLE_16* rect = &updateRects[j];
const UINT32 nXSrc = rect->left - (nXDst + tile->x);
const UINT32 nYSrc = rect->top - (nYDst + tile->y);
if (rect->left < updateRect.left)
goto fail;
const UINT32 nXSrc = rect->left - updateRect.left;
const UINT32 nYSrc = rect->top - updateRect.top;
const UINT32 width = rect->right - rect->left;
const UINT32 height = rect->bottom - rect->top;

if (rect->left + width > surface->width)
goto fail;
if (rect->top + height > surface->height)
goto fail;
if (!freerdp_image_copy(pDstData, DstFormat, nDstStep, rect->left, rect->top, width,
height, tile->data, progressive->format, tile->stride, nXSrc,
nYSrc, NULL, FREERDP_FLIP_NONE))
Expand Down

0 comments on commit 23c3dae

Please sign in to comment.