From 7c26a9aefee00221df0d42d6cb753f4931473675 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Thu, 25 Mar 2021 09:58:50 -0600 Subject: HID: Initialize correctly the gesture finger_id and filter invalid results --- src/core/hle/service/hid/controllers/touchscreen.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/hle/service/hid/controllers/touchscreen.cpp') diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 5219f2dad..be60492a4 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -5,6 +5,7 @@ #include #include #include "common/common_types.h" +#include "common/logging/log.h" #include "core/core_timing.h" #include "core/frontend/emu_window.h" #include "core/frontend/input.h" @@ -118,6 +119,10 @@ std::optional Controller_Touchscreen::GetUnusedFingerID() const { std::size_t Controller_Touchscreen::UpdateTouchInputEvent( const std::tuple& touch_input, std::size_t finger_id) { const auto& [x, y, pressed] = touch_input; + if (finger_id > MAX_FINGERS) { + LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); + return MAX_FINGERS; + } if (pressed) { Attributes attribute{}; if (finger_id == MAX_FINGERS) { -- cgit v1.2.3