[patch] aalib driver

Hi there. The attached patch fixes a buffer overflow in the aalib
driver and also adds a workaround for a conflict between arrow keys and
the numeric keypad that have the same scancode on aalib. The patch gives
precedence to the arrow keys.–
Sam.
-------------- next part --------------
diff -puriN SDL-1.2.9.orig/src/video/aalib/SDL_aaevents.c SDL-1.2.9/src/video/aalib/SDL_aaevents.c
— SDL-1.2.9.orig/src/video/aalib/SDL_aaevents.c 2004-01-04 17:49:23 +0100
+++ SDL-1.2.9/src/video/aalib/SDL_aaevents.c 2006-02-28 02:17:45 +0100
@@ -130,12 +130,6 @@ void AA_InitOSKeymap(_THIS)
for ( i=0; i<SDL_TABLESIZE(keymap); ++i )
keymap[i] = SDLK_UNKNOWN;

  • keymap[AA_ESC] = SDLK_ESCAPE;
  • keymap[AA_UP] = SDLK_UP;
  • keymap[AA_DOWN] = SDLK_DOWN;
  • keymap[AA_LEFT] = SDLK_LEFT;
  • keymap[AA_RIGHT] = SDLK_RIGHT;
  • /* Alphabet keys */
    for ( i = 0; i<26; ++i ){
    keymap[‘a’ + i] = SDLK_a+i;
    @@ -183,10 +177,20 @@ void AA_InitOSKeymap(_THIS)
    keymap[293] = SDLK_KP7;
    keymap[295] = SDLK_KP8;
    keymap[298] = SDLK_KP9;
  • keymap[AA_ESC] = SDLK_ESCAPE;
  • keymap[AA_UP] = SDLK_UP;
  • keymap[AA_DOWN] = SDLK_DOWN;
  • keymap[AA_LEFT] = SDLK_LEFT;
  • keymap[AA_RIGHT] = SDLK_RIGHT;
    }

static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
{

  • /* Sanity check */
  • if ( scancode > 400 )
  •   scancode = AA_UNKNOWN;
    
  • /* Set the keysym information */
    keysym->scancode = scancode;
    keysym->sym = keymap[scancode];

Hi there. The attached patch fixes a buffer overflow in the aalib
driver and also adds a workaround for a conflict between arrow keys and
the numeric keypad that have the same scancode on aalib. The patch gives
precedence to the arrow keys.

This is in CVS, thanks!

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment