diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-26 17:34:50 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-26 17:34:50 -0700 |
commit | 2397640740e053af7ef4aa742467f723186d5ad7 (patch) | |
tree | 3807a4783a8e6690f9448c9a819115c26d392074 | |
parent | 093f581090d8cf98f5877746d924107f7695dd8b (diff) | |
download | frameworks_base-2397640740e053af7ef4aa742467f723186d5ad7.zip frameworks_base-2397640740e053af7ef4aa742467f723186d5ad7.tar.gz frameworks_base-2397640740e053af7ef4aa742467f723186d5ad7.tar.bz2 |
Maybe fix issue #2145012: Array bounds exception in touch event processing
Change-Id: I223d9ae29f22f08cb8426ccd8bbadeedd5db3fc3
-rw-r--r-- | core/java/android/view/MotionEvent.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index b2f0c60..ca907af 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -1104,13 +1104,13 @@ public final class MotionEvent implements Parcelable { final int NS = mNumSamples; final int NI = NP*NS; final int ND = NI * NUM_SAMPLE_DATA; - if (data.length <= ND) { + if (data.length < (ND+(NP*NUM_SAMPLE_DATA))) { final int NEW_ND = ND + (NP * (BASE_AVAIL_SAMPLES * NUM_SAMPLE_DATA)); float[] newData = new float[NEW_ND]; System.arraycopy(data, 0, newData, 0, ND); mDataSamples = data = newData; } - if (times.length <= NS) { + if (times.length < (NS+1)) { final int NEW_NS = NS + BASE_AVAIL_SAMPLES; long[] newHistoryTimes = new long[NEW_NS]; System.arraycopy(times, 0, newHistoryTimes, 0, NS); |