diff options
author | 2013-10-07 22:31:21 +0900 | |
---|---|---|
committer | 2013-10-07 23:16:57 +0900 | |
commit | ca9c3c06137af878607f16573585c72041a4b7bf (patch) | |
tree | 9d5c184cc4c2110c88d11edbeeb27ce4cd2dc6cc /java/src | |
parent | 291ef1c9c304bc6eae352e08f4ca86854853ee29 (diff) | |
download | latinime-ca9c3c06137af878607f16573585c72041a4b7bf.tar.gz latinime-ca9c3c06137af878607f16573585c72041a4b7bf.tar.xz latinime-ca9c3c06137af878607f16573585c72041a4b7bf.zip |
Fix a possible IOOB
We want to use StringUtils here, but it's full of references to
stuff not accessible host-side like JsonReader and TextUtils
and SettingsValues :/
Bug: 11061476
Change-Id: I3c0194979833ede283b4f9190335dba5376fe6fc
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java index be653feec..3bb218bea 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java +++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java @@ -367,10 +367,11 @@ public final class FusionDictionary implements Iterable<Word> { * Helper method to convert a String to an int array. */ static int[] getCodePoints(final String word) { - // TODO: this is a copy-paste of the contents of StringUtils.toCodePointArray, + // TODO: this is a copy-paste of the old contents of StringUtils.toCodePointArray, // which is not visible from the makedict package. Factor this code. + final int length = word.length(); + if (length <= 0) return new int[] {}; final char[] characters = word.toCharArray(); - final int length = characters.length; final int[] codePoints = new int[Character.codePointCount(characters, 0, length)]; int codePoint = Character.codePointAt(characters, 0); int dsti = 0; |