[aseprite] 31/250: Fix invalid key[] access in _handle_key_press()

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit adce0b9569e945ef3db81b292dbd5cc9efaa5065
Author: David Capello <davidcapello at gmail.com>
Date:   Fri Sep 11 15:12:21 2015 -0300

    Fix invalid key[] access in _handle_key_press()
    
    On Windows, if we pressed numpad dot key, all timers start working
    incorrectly (e.g. animations couldn't be reproduced anymore.).
    There was one report about this same issue on Mac OS X.
---
 src/allegro/src/keyboard.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/allegro/src/keyboard.c b/src/allegro/src/keyboard.c
index e5650af..ba7b29e 100644
--- a/src/allegro/src/keyboard.c
+++ b/src/allegro/src/keyboard.c
@@ -439,6 +439,11 @@ void _handle_key_press(int keycode, int scancode)
 {
    ASSERT(keyboard_driver);
 
+   if (scancode < 0 || scancode >= KEY_MAX) {
+      TRACE(PREFIX_I "Scancode out of range %d pressed\n", scancode);
+      return;
+   }
+
    if ((keyboard_driver->poll) || (!keyboard_polled)) {
       /* process immediately */
       if (scancode > 0) {
@@ -497,12 +502,8 @@ void _handle_key_release(int scancode)
       repeat_scan = -1;
    }
 
-   /* This is quite common if we press the numpad dot/delete. In debug
-      mode this asserts crashes the whole program. */
-   /* ASSERT(scancode < KEY_MAX); */
-
-   if (scancode >= KEY_MAX) {
-      TRACE(PREFIX_I "Scancode out of range %d\n", scancode);
+   if (scancode < 0 || scancode >= KEY_MAX) {
+      TRACE(PREFIX_I "Scancode out of range %d released\n", scancode);
       return;
    }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list