changeset 1614:6162b8d921ce

Date: Wed, 29 Mar 2006 17:26:55 +0200 CEST From: "Fran���is Revol" Subject: [SDL] BeOS port fix: PrintScreen key crashing It seems the latest SDL crashes when someone hits the PrtScrn key in ZETA (BeOS R6), somewhere it gets a negative value as key code (or a big unsigned maybe ?), and uses it as an index in the keysym table... I'll investigate the cause for the negative value, but it's always better to check for bounds correctly when indexing a table. The attached diff fixes it. Fran���is Revol -- Software Architect yellowTAB GmbH
author Sam Lantinga <slouken@libsdl.org>
date Fri, 31 Mar 2006 06:16:20 +0000
parents 2095da6364c9
children d5298e8f22b3
files src/video/bwindow/SDL_BWin.h
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/bwindow/SDL_BWin.h	Sat Mar 25 20:40:30 2006 +0000
+++ b/src/video/bwindow/SDL_BWin.h	Fri Mar 31 06:16:20 2006 +0000
@@ -478,7 +478,7 @@
 				if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
 					SDL_keysym keysym;
 					keysym.scancode = key;
-					if (key < 128) {
+					if ((key > 0) && (key < 128)) {
 						keysym.sym = keymap[key];
 					} else {
 						keysym.sym = SDLK_UNKNOWN;
@@ -511,7 +511,7 @@
 				if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
 					SDL_keysym keysym;
 					keysym.scancode = key;
-					if (key < 128) {
+					if ((key > 0) && (key < 128)) {
 						keysym.sym = keymap[key];
 					} else {
 						keysym.sym = SDLK_UNKNOWN;