Skip to content

Commit

Permalink
Date: Wed, 29 Mar 2006 17:26:55 +0200 CEST
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slouken committed Mar 31, 2006
1 parent 3bb871c commit ab73d84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/bwindow/SDL_BWin.h
Expand Up @@ -478,7 +478,7 @@ class SDL_BWin : public BDirectWindow
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;
Expand Down Expand Up @@ -511,7 +511,7 @@ class SDL_BWin : public BDirectWindow
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;
Expand Down

0 comments on commit ab73d84

Please sign in to comment.