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

Commit ca9c3c06 authored by Jean Chalard's avatar Jean Chalard
Browse files

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
parent 291ef1c9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;