[PATCH 0/1] MR10378: winemac: Avoid matching scan code 0 in GetKeyNameText.
The `keyc2scan` array is populated with the `default_map`, which has the line ``` { 0, 0, FALSE }, /* 0x34 unused */ ``` An application requesting scan code 0 in `GetKeyNameText`, then matches this in `if (thread_data->keyc2scan[keyc] == scan)` and the subsequent call to `UCKeyTranslate` succeeds (probably an apple bug), but doesn't update len or updates the buffer in any way. So the random stack content of the caller is just returned. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10378
From: Marc-Aurel Zent <mzent@codeweavers.com> --- dlls/winemac.drv/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 7c49be7849f..64abc5b161f 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1209,7 +1209,7 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) scan = (lparam >> 16) & 0x1FF; for (keyc = 0; keyc < ARRAY_SIZE(thread_data->keyc2scan); keyc++) { - if (thread_data->keyc2scan[keyc] == scan) + if (thread_data->keyc2scan[keyc] == scan && scan) { const UCKeyboardLayout *uchr; UInt32 deadKeyState = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10378
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10378
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10378
participants (4)
-
Huw Davies (@huw) -
Marc-Aurel Zent -
Marc-Aurel Zent (@mzent) -
Rémi Bernon