From ec81a353c24eecb429d7b00226bba71586d6e48d Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 26 Apr 2021 03:19:29 -0400 Subject: [PATCH] [host] nvfbc: fix null dereference in mouse hook handler Since we now let the mouse hook linger until the process is killed, the cursor event that the hook signals may now be null, as the capture could have stopped. If the hook fires during this time, a crash occurs. --- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 3c0f0c01..b287afd6 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -91,7 +91,8 @@ static void on_mouseMove(int x, int y) this->hasMousePosition = true; this->mouseX = x; this->mouseY = y; - lgSignalEvent(this->cursorEvents[0]); + if (this->cursorEvents[0]) + lgSignalEvent(this->cursorEvents[0]); } static const char * nvfbc_getName(void)