Prevent exceeding array bounds in X11 key-repeat detection
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@489 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
041d8017dc
commit
101fd08582
@ -968,12 +968,15 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
|||||||
char keys[32];
|
char keys[32];
|
||||||
XQueryKeymap( fgDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */
|
XQueryKeymap( fgDisplay.Display, keys ); /* Look at X11 keystate to detect repeat mode */
|
||||||
|
|
||||||
|
if ( event.xkey.keycode<256 ) /* XQueryKeymap is limited to 256 keycodes */
|
||||||
|
{
|
||||||
if ( keys[event.xkey.keycode>>3] & (1<<(event.xkey.keycode%8)) )
|
if ( keys[event.xkey.keycode>>3] & (1<<(event.xkey.keycode%8)) )
|
||||||
window->State.KeyRepeating = GL_TRUE;
|
window->State.KeyRepeating = GL_TRUE;
|
||||||
else
|
else
|
||||||
window->State.KeyRepeating = GL_FALSE;
|
window->State.KeyRepeating = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
window->State.KeyRepeating = GL_FALSE;
|
window->State.KeyRepeating = GL_FALSE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user