49 lines
1.5 KiB
Diff
49 lines
1.5 KiB
Diff
From 33e12b7cfb83875479822769ffd4fda799f294ff Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Holy <oholy@redhat.com>
|
|
Date: Mon, 16 Mar 2026 14:58:52 +0100
|
|
Subject: [PATCH] [codec,nsc] limit copy area in nsc_process_message
|
|
|
|
Backport of commit 83d9aedea278a74af3e490ff5eeb889c016dbb2b.
|
|
|
|
Made-with: Cursor
|
|
---
|
|
libfreerdp/codec/nsc.c | 15 ++++++++++++---
|
|
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c
|
|
index f7a5e920f..916e5ff8d 100644
|
|
--- a/libfreerdp/codec/nsc.c
|
|
+++ b/libfreerdp/codec/nsc.c
|
|
@@ -22,6 +22,7 @@
|
|
|
|
#include <freerdp/config.h>
|
|
|
|
+#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
@@ -502,9 +503,17 @@ BOOL nsc_process_message(NSC_CONTEXT* WINPR_RESTRICT context, UINT16 bpp, UINT32
|
|
return FALSE;
|
|
}
|
|
|
|
- if (!freerdp_image_copy_no_overlap(pDstData, DstFormat, nDstStride, nXDst, nYDst, width, height,
|
|
- context->BitmapData, PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL,
|
|
- flip))
|
|
+ uint32_t cwidth = width;
|
|
+ if (1ull * nXDst + width > nWidth)
|
|
+ cwidth = nWidth - nXDst;
|
|
+
|
|
+ uint32_t cheight = height;
|
|
+ if (1ull * nYDst + height > nHeight)
|
|
+ cheight = nHeight - nYDst;
|
|
+
|
|
+ if (!freerdp_image_copy_no_overlap(pDstData, DstFormat, nDstStride, nXDst, nYDst, cwidth,
|
|
+ cheight, context->BitmapData, PIXEL_FORMAT_BGRA32, 0, 0, 0,
|
|
+ NULL, flip))
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
--
|
|
2.53.0
|
|
|