Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: ui/events/ozone/evdev/touch_event_converter_evdev.cc

Issue 891703004: Seeing crashes likely from negative touch indexes, check for them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/touch_event_converter_evdev.cc
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
index 3cca7ac012a268c59fbb9c2e20ccdf2c056c8967..c50a0bc4e1958ca14313887dceca4d17c6f55639 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -170,8 +170,9 @@ void TouchEventConverterEvdev::ProcessInputEvent(const input_event& input) {
} else if(syn_dropped_) {
// Do nothing. This branch indicates we have lost sync with the driver.
} else if (input.type == EV_ABS) {
- if (current_slot_ >= MAX_FINGERS) {
- LOG(ERROR) << "too many touch events: " << current_slot_;
+ if ((current_slot_ >= MAX_FINGERS || current_slot_ < 0) &&
+ input.code != ABS_MT_SLOT) {
spang 2015/02/02 19:22:00 Can't we keep the range check inside "case ABS_MT_
+ LOG(ERROR) << "invalid touch event index: " << current_slot_;
return;
}
ProcessAbs(input);
@@ -223,13 +224,7 @@ void TouchEventConverterEvdev::ProcessAbs(const input_event& input) {
events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_;
break;
case ABS_MT_SLOT:
- if (input.value >= MAX_FINGERS) {
- LOG(ERROR) << "multi-touch slot " << input.value
- << " exceeds MAX_FINGERS";
- break;
- }
current_slot_ = input.value;
- altered_slots_.set(current_slot_);
break;
default:
DVLOG(5) << "unhandled code for EV_ABS: " << input.code;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698