diff options
author | Flanker <i@flanker017.me> | 2015-09-07 15:28:58 +0800 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-10-27 10:38:38 -0700 |
commit | 8ac7474234d62958e88d60bc0e942711ad9272ed (patch) | |
tree | cb2ca6909b7f9cea566ece0f31ad3424fcf01778 | |
parent | 67a7582bae53bc29c64975226be6c58f5864f1d5 (diff) | |
download | frameworks_native-android-5.1.1_r30.zip frameworks_native-android-5.1.1_r30.tar.gz frameworks_native-android-5.1.1_r30.tar.bz2 |
add number constraint for samples per MotionEventandroid-5.1.1_r34android-5.1.1_r33android-5.1.1_r30
Bug:23905002
Signed-off-by: Adam Lesinski <adamlesinski@google.com>
(cherry picked from commit 552a8a5d8df32f659b8d11311a244cdc6d3b7733)
Change-Id: I9b7ea859889b7697bee4165a2746602212120543
-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 96b6885..a8df11b 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 3a7afe9..cd55ee5 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -421,7 +421,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; } |