diff options
author | Flanker <i@flanker017.me> | 2015-10-22 22:28:01 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-10-22 22:28:01 +0000 |
commit | a82ace99f76ed815e16ab64eae2e9e55871a8b8f (patch) | |
tree | 84452b1e89976357675daf0e9e1582a932fddbca | |
parent | 8121177b5e8c406570f0eaf6593c6fd1db232ddf (diff) | |
parent | 9830f11dc6b6aa4001c79147966fdb9eaa71c2f2 (diff) | |
download | frameworks_native-a82ace99f76ed815e16ab64eae2e9e55871a8b8f.zip frameworks_native-a82ace99f76ed815e16ab64eae2e9e55871a8b8f.tar.gz frameworks_native-a82ace99f76ed815e16ab64eae2e9e55871a8b8f.tar.bz2 |
add number constraint for samples per MotionEvent am: 5d17838ade am: 72c8ca4a01 am: 9964d83869 am: 90dc6dc825
am: 9830f11dc6
* commit '9830f11dc6b6aa4001c79147966fdb9eaa71c2f2':
add number constraint for samples per MotionEvent
-rw-r--r-- | include/input/Input.h | 5 | ||||
-rw-r--r-- | libs/input/Input.cpp | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/include/input/Input.h b/include/input/Input.h index 4a67f47..92b3d36 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -111,6 +111,11 @@ enum { #define MAX_POINTERS 16 /* + * Maximum number of samples supported per motion event. + */ +#define MAX_SAMPLES UINT16_MAX + +/* * Maximum pointer id value supported in a motion event. * Smallest pointer id is 0. * (This is limited by our use of BitSet32 to track pointer assignments.) diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 2c1418e..b64cb2c 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -424,7 +424,8 @@ void MotionEvent::transform(const float matrix[9]) { status_t MotionEvent::readFromParcel(Parcel* parcel) { size_t pointerCount = parcel->readInt32(); size_t sampleCount = parcel->readInt32(); - if (pointerCount == 0 || pointerCount > MAX_POINTERS || sampleCount == 0) { + if (pointerCount == 0 || pointerCount > MAX_POINTERS || + sampleCount == 0 || sampleCount > MAX_SAMPLES) { return BAD_VALUE; } |