[gnome-remote-desktop/wip/memcpy-rowstride-fix: 4/4] rdp-pipewire-stream: Correct memcpy size calculation
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop/wip/memcpy-rowstride-fix: 4/4] rdp-pipewire-stream: Correct memcpy size calculation
- Date: Thu, 27 Aug 2020 18:17:31 +0000 (UTC)
commit a2a4db8aab37c96d148441501856c50c8c12a1f6
Author: Ray Strode <rstrode redhat com>
Date: Thu Aug 27 14:04:03 2020 -0400
rdp-pipewire-stream: Correct memcpy size calculation
The previous commit addressed an issue with memcpy size
calculation in the vnc backend. The rdp backend inherited,
the same bug: a potential crash when the source row stride
is less than the destination row stride.
This commit introduces the same fix, using the width of the
row pixel data, only, when performing the copy.
https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/merge_requests/18
src/grd-rdp-pipewire-stream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index a8491ad..5589fca 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -318,18 +318,20 @@ process_buffer (GrdRdpPipeWireStream *stream,
int src_stride;
int dst_stride;
int height;
+ int width;
int y;
src_stride = buffer->datas[0].chunk->stride;
dst_stride = grd_session_rdp_get_framebuffer_stride (stream->session_rdp);
height = stream->spa_format.size.height;
+ width = stream->spa_format.size.width;
frame->data = g_malloc (height * dst_stride);
for (y = 0; y < height; ++y)
{
memcpy (((uint8_t *) frame->data) + y * dst_stride,
((uint8_t *) src_data) + y * src_stride,
- dst_stride);
+ width * 4);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]