summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-06-06 20:15:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-06 20:15:27 +0000
commitdf8427c32484dcdec25618cb6537c7280acad0fa (patch)
tree47b1698a22f4274d64350331634658c19321e90b /core/java/android
parent8a17910f81a75dfd395344dfcc548a489f212e45 (diff)
parent8d2aa199774f50256617351bf9caaaef59d47c59 (diff)
downloadframeworks_base-df8427c32484dcdec25618cb6537c7280acad0fa.zip
frameworks_base-df8427c32484dcdec25618cb6537c7280acad0fa.tar.gz
frameworks_base-df8427c32484dcdec25618cb6537c7280acad0fa.tar.bz2
Merge "Fix android.text.cts.TextUtilsTest#testRegionMatches"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/text/TextUtils.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index f06ae71..48122d6 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -48,10 +48,11 @@ import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.util.Printer;
-
import android.view.View;
+
import com.android.internal.R;
import com.android.internal.util.ArrayUtils;
+
import libcore.icu.ICU;
import java.lang.reflect.Array;
@@ -229,7 +230,12 @@ public class TextUtils {
public static boolean regionMatches(CharSequence one, int toffset,
CharSequence two, int ooffset,
int len) {
- char[] temp = obtain(2 * len);
+ int tempLen = 2 * len;
+ if (tempLen < len) {
+ // Integer overflow; len is unreasonably large
+ throw new IndexOutOfBoundsException();
+ }
+ char[] temp = obtain(tempLen);
getChars(one, toffset, toffset + len, temp, 0);
getChars(two, ooffset, ooffset + len, temp, len);