From 09a7e177fabb3fecede3108beafc327a31897db4 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 28 May 2021 17:00:13 +1000 Subject: [PATCH] [client] core: fix use of unintalized variable util_guestCurToLocal may not be able to provide the local position if we do not yet know where the guest cursor is, or the destination render rect dimensions. Acting on this when this information is unknown causes undefined behaivour. --- client/src/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/core.c b/client/src/core.c index 1c03d1ef..06f8b40f 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -319,7 +319,9 @@ void core_stopFrameThread(void) void core_handleGuestMouseUpdate(void) { struct DoublePoint localPos; - util_guestCurToLocal(&localPos); + if (!util_guestCurToLocal(&localPos)) + return; + g_state.ds->guestPointerUpdated( g_cursor.guest.x, g_cursor.guest.y, util_clamp(localPos.x, g_state.dstRect.x,