From f92099657f465d782a8e32444d59f8ebdbdce182 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Jul 2013 16:44:37 +0000 Subject: [PATCH] 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 --- src/unix/joystick.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index f9f2ba9..4bf9168 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) ) { -- 2.7.4