From fa95b24c889a0d24b63fbde77e5a430380c6930b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 2 May 2013 12:00:58 -0700 Subject: fix SDL.keyboardState size to add safe buffer zone --- src/library_sdl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/library_sdl.js') diff --git a/src/library_sdl.js b/src/library_sdl.js index 911b83e2..a1fb871f 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -653,8 +653,8 @@ var LibrarySDL = { document.addEventListener("visibilitychange", SDL.receiveEvent); } window.onunload = SDL.receiveEvent; - SDL.keyboardState = _malloc(1024); // SDL needs 512, add some buffer to be safe - _memset(SDL.keyboardState, 0, 1024); + SDL.keyboardState = _malloc(0x10000); // Our SDL needs 512, but 64K is safe for older SDLs + _memset(SDL.keyboardState, 0, 0x10000); // Initialize this structure carefully for closure SDL.DOMEventToSDLEvent['keydown'] = 0x300 /* SDL_KEYDOWN */; SDL.DOMEventToSDLEvent['keyup'] = 0x301 /* SDL_KEYUP */; -- cgit v1.2.3-18-g5258