mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-08-31 09:45:24 +02:00
TouchInput::id was used directly to index the global primaryButton[] array (MultiTouchButton::Touch) and to shift pointer bitmasks (PSPDpad/PSPStick/PSPCustomStick/GestureGamepad::Touch), guarded only by a debug-only assert in one of the five call sites - a no-op in release builds. input.id isn't always a small sequential slot in [0, TOUCH_MAX_POINTERS): SDL assigns SDL_FingerID values directly, Android pointer IDs can go up to 31, and UWP's TouchMapper allocates one more slot (11) than TOUCH_MAX_POINTERS (10) and can also return -1 when it runs out of slots - all reachable through ordinary multi-touch use, no malicious input required. Also apply bounds check to the PER_GAME gesture config ints (iDoubleTapGesture/iSwipeUp/Down/Left/Right) before indexing GestureKey::keyList[] with them. Additionally, minor cleanup on Android and moves the TouchMapper helper out from UWP to InputState.h.