Added dinput-regression-fix patchset

This commit is contained in:
Alistair Leslie-Hughes 2024-08-11 14:59:14 +10:00
parent a7f29f1236
commit 75f3eede59
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,29 @@
From 434df65f9023ec64c175825e5b38cd9daf744565 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aida=20Jonikien=C4=97?= <aidas957@gmail.com>
Date: Sat, 10 Aug 2024 22:20:30 +0300
Subject: [PATCH] dinput: Use the correct array index in
keyboard_create_device().
This fixes a segfault when launching NFS Underground.
Fixes: f434ea12b83 ("dinput: Implement DIPROP_SCANCODE.")
---
dlls/dinput/keyboard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index a83f825e97d..aee1d996dde 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -211,7 +211,7 @@ HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirect
if (FAILED(hr = dinput_device_init_device_format( &impl->base.IDirectInputDevice8W_iface ))) goto failed;
- for (i = 0, index = 0; i < 512; ++i)
+ for (i = 0, index = 0; i < impl->base.device_format.dwNumObjs; ++i)
{
if (!GetKeyNameTextW( i << 16, instance.tszName, ARRAY_SIZE(instance.tszName) )) continue;
if (!(dik = map_dik_code( i, 0, subtype, impl->base.dinput->dwVersion ))) continue;
--
2.43.0

View File

@ -0,0 +1,5 @@
Fixes: Fix crash in NFS Underground
#Depends: dinput-joy-mappings
Depends: dinput-scancode
# PR 6249