Patch (ShortcutHandler.java)

Peter Graves peter at armedbear.org
Fri Feb 4 16:24:29 PST 2000


In java.awt.ShortcutHandler.handle(), getKeyCode (at the top of the
function) is sometimes returning values < 0 (for reasons I haven't had
time to investigate).

The following trivial patch just adds a bit of bulletproofing to avoid
an array out of bounds exception when the returned value is subsequently
used to index into the codeTable array.

-Peter
http://armedbear.org


RCS file:
/cvs/kaffe/kaffe/libraries/javalib/java/awt/ShortcutHandler.java,v
retrieving revision 1.3
diff -u -r1.3 ShortcutHandler.java
--- ShortcutHandler.java        1999/07/24 00:56:13     1.3
+++ ShortcutHandler.java        2000/02/04 23:56:23
@@ -159,7 +159,7 @@
                        cc += 64;
        }
        
-       if ( cc >= codeTable.length )
+       if ( cc < 0 || cc >= codeTable.length )
                return false;
 
        MenuShortcut ms;


More information about the kaffe mailing list