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

Commit 574ecc8e authored by Kenny Root's avatar Kenny Root Committed by Android (Google) Code Review
Browse files

Merge "Add better index checks for AndroidCharacter.mirror"

parents 479ae0a2 073a3d56
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ public class AndroidCharacter
     * Replace the specified slice of <code>text</code> with the chars'
     * right-to-left mirrors (if any), returning true if any
     * replacements were made.
     *
     * @param text array of characters to apply mirror operation
     * @param start first character in array to mirror
     * @param count maximum number of characters to mirror
     * @return true if replacements were made
     */
    public native static boolean mirror(char[] text, int start, int count);

+2 −1
Original line number Diff line number Diff line
@@ -165,7 +165,8 @@ static jboolean mirror(JNIEnv* env, jobject obj, jcharArray charArray, int start
        goto MIRROR_END;
    }

    if (start > start + count || env->GetArrayLength(charArray) < count) {
    if (start < 0 || start > start + count
            || env->GetArrayLength(charArray) < start + count) {
        jniThrowException(env, "java/lang/ArrayIndexOutOfBoundsException", NULL);
        goto MIRROR_END;
    }