From eb8e07f1a20416b78d33e8bf7de58a752e9f6f1a Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Wed, 30 May 2007 09:35:41 +0000 Subject: [PATCH] - Do not look outside VkToWcharTable[]. - Check for WCH_NONE. svn path=/trunk/; revision=26940 --- reactos/subsystems/win32/win32k/ntuser/keyboard.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/keyboard.c b/reactos/subsystems/win32/win32k/ntuser/keyboard.c index e725d4db1bc..eda53efea78 100644 --- a/reactos/subsystems/win32/win32k/ntuser/keyboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/keyboard.c @@ -248,6 +248,7 @@ static BOOL TryToTranslateChar(WORD wVirtKey, { return FALSE; } + for (nMod = 0; keyLayout->pVkToWcharTable[nMod].nModifications; nMod++) { vtwTbl = &keyLayout->pVkToWcharTable[nMod]; @@ -263,13 +264,12 @@ static BOOL TryToTranslateChar(WORD wVirtKey, if( CapsMod >= keyLayout->pVkToWcharTable[nMod].nModifications ) { - DWORD MaxBit = 1; - while( MaxBit < - keyLayout->pVkToWcharTable[nMod].nModifications ) - MaxBit <<= 1; + return FALSE; + } - CapsMod &= MaxBit - 1; /* Guarantee that CapsMod lies - in bounds. */ + if( vkPtr->wch[CapsMod] == WCH_NONE ) + { + return FALSE; } *pbDead = vkPtr->wch[CapsMod] == WCH_DEAD;