From: Vadim Zeitlin Date: Tue, 9 Jul 2013 16:44:37 +0000 (+0000) Subject: Check axis number in the received joystick messages. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f92099657f465d782a8e32444d59f8ebdbdce182 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 --- diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index f9f2ba9d41..4bf9168ea0 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -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) ) {