Check axis number in the received joystick messages.

Closes #15313.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-07-09 16:44:37 +00:00
parent d459632844
commit f92099657f

View File

@ -136,6 +136,14 @@ void* wxJoystickThread::Entry()
if ((j_evt.type & JS_EVENT_AXIS) && (j_evt.number < wxJS_MAX_AXES))
{
// Ignore invalid axis.
if ( j_evt.number >= wxJS_MAX_AXES )
{
wxLogDebug(wxS("Invalid axis index %d in joystick message."),
j_evt.number);
continue;
}
if ( (m_axe[j_evt.number] + m_threshold < j_evt.value)
|| (m_axe[j_evt.number] - m_threshold > j_evt.value) )
{