Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23976407 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Maybe fix issue #2145012: Array bounds exception in touch event processing

Change-Id: I223d9ae29f22f08cb8426ccd8bbadeedd5db3fc3
parent 093f5810
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);