diff options
| author | 2017-12-20 18:16:04 +0000 | |
|---|---|---|
| committer | 2017-12-20 18:16:04 +0000 | |
| commit | b899c4c281adc016790884f28c245be215295900 (patch) | |
| tree | b2dcab6692d903abe79fd269facafb595893e258 | |
| parent | 201a44a961deac11a7b4821c09a6c3e9b5c8120d (diff) | |
| parent | bfdea369b7369f29768929b4574125b18a63d836 (diff) | |
Merge "Fix sanitizer in InputFlinger Reader/Dispatcher."
am: bfdea369b7
Change-Id: I69d877f6a7bb2501f97276fe5ff5e16bdc2a2e5b
| -rw-r--r-- | services/inputflinger/InputDispatcher.cpp | 6 | ||||
| -rw-r--r-- | services/inputflinger/InputReader.cpp | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp index 42f9ba9047..98e135d530 100644 --- a/services/inputflinger/InputDispatcher.cpp +++ b/services/inputflinger/InputDispatcher.cpp @@ -2902,7 +2902,7 @@ void InputDispatcher::setInputWindows(const Vector<sp<InputWindowHandle> >& inpu for (size_t d = 0; d < mTouchStatesByDisplay.size(); d++) { TouchState& state = mTouchStatesByDisplay.editValueAt(d); - for (size_t i = 0; i < state.windows.size(); i++) { + for (size_t i = 0; i < state.windows.size(); ) { TouchedWindow& touchedWindow = state.windows.editItemAt(i); if (!hasWindowHandleLocked(touchedWindow.windowHandle)) { #if DEBUG_FOCUS @@ -2917,7 +2917,9 @@ void InputDispatcher::setInputWindows(const Vector<sp<InputWindowHandle> >& inpu synthesizeCancelationEventsForInputChannelLocked( touchedInputChannel, options); } - state.windows.removeAt(i--); + state.windows.removeAt(i); + } else { + ++i; } } } diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp index d4266f6df9..420d06b671 100644 --- a/services/inputflinger/InputReader.cpp +++ b/services/inputflinger/InputReader.cpp @@ -1174,7 +1174,7 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) { // gamepad button presses are handled by different mappers but they should be dispatched // in the order received. size_t numMappers = mMappers.size(); - for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) { + for (const RawEvent* rawEvent = rawEvents; count != 0; rawEvent++) { #if DEBUG_RAW_EVENTS ALOGD("Input event: device=%d type=0x%04x code=0x%04x value=0x%08x when=%lld", rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value, @@ -1202,6 +1202,7 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) { mapper->process(rawEvent); } } + --count; } } |