From 19eaba3cddda1765839a9f17df08f0fc17e98d5d Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 25 Jan 2015 03:34:14 -0800 Subject: [PATCH] GBA: Fix unmapping values that are out of range --- src/gba/gba-input.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gba/gba-input.c b/src/gba/gba-input.c index 5bd8c27c8..80b640179 100644 --- a/src/gba/gba-input.c +++ b/src/gba/gba-input.c @@ -312,6 +312,9 @@ void GBAInputBindKey(struct GBAInputMap* map, uint32_t type, int key, enum GBAKe void GBAInputUnbindKey(struct GBAInputMap* map, uint32_t type, enum GBAKey input) { struct GBAInputMapImpl* impl = _lookupMap(map, type); + if (input < 0 || input >= GBA_KEY_MAX) { + return; + } if (impl) { impl->map[input] = GBA_NO_MAPPING; }