From fe15c77d30b94a8b720b520dcacf39a0c832d58f Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Thu, 10 Aug 2023 05:29:15 +0200 Subject: [Hotfix] hid: Prevent out of bounds array access (#5547) * hid: Prevent out of bounds array access * Cast player to uint * Replace lambda function with local function --- src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Ryujinx.HLE/HOS') diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index 240933ad..86c6a825 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -70,6 +70,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid internal void SetSupportedPlayer(PlayerIndex player, bool supported = true) { + if ((uint)player >= _supportedPlayers.Length) + { + return; + } + _supportedPlayers[(int)player] = supported; } -- cgit v1.2.3