[gnome-remote-desktop/wip/memcpy-rowstride-fix: 1/2] vnc-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: 1/2] vnc-pipewire-stream: Correct memcpy size calculation
- Date: Thu, 27 Aug 2020 18:11:39 +0000 (UTC)
commit 2aa5e094effb2ff05da24427d32c66b8822dd851
Author: Ray Strode <rstrode redhat com>
Date: Thu Aug 27 14:04:03 2020 -0400
vnc-pipewire-stream: Correct memcpy size calculation
commit 78c5bcb181fe2b0b9fc17eea696feac8b504df54 introduced code
to try to account for a row stride mismatch between source and
destination.
This commit, however, erroneously copies destination stride bytes
from the source, which will lead to out of bounds access if the
source has a smaller row stride.
This commit addresses the problem, by instead, copying just the
pixel data, and none of the row margin.
src/grd-vnc-pipewire-stream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
index 046c32d..ace2b5d 100644
--- a/src/grd-vnc-pipewire-stream.c
+++ b/src/grd-vnc-pipewire-stream.c
@@ -314,19 +314,21 @@ process_buffer (GrdVncPipeWireStream *stream,
{
int src_stride;
int dst_stride;
+ int width;
int height;
int y;
src_stride = buffer->datas[0].chunk->stride;
dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
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]