Add input validation to SDL_GetKeyFromScancode; fix compiler warning in testautomation driver on Linux; update keyboard test suite

This commit is contained in:
Andreas Schiffler 2013-01-13 22:55:26 -08:00
parent 175511b1a0
commit 3bc9dbe16c
3 changed files with 47 additions and 4 deletions

View file

@ -860,6 +860,11 @@ SDL_Keycode
SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
if (scancode<SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return 0;
}
return keyboard->keymap[scancode];
}