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

Commit 68669a42 authored by Raph Levien's avatar Raph Levien
Browse files

Fix for AIOBE at android.text.AndroidBidi.directions

This fixes bug 9900288: Multiple apps crashing; AIOBE at
android.text.AndroidBidi.directions.

The AndroidBidi.directions() method was not correctly handling the case
of a run of length 0, causing ArrayIndexOutOfBoundsException. This
patch simply avoids accessing the levels array in that case.

Change-Id: I036a85b7792ea3364725a87033ca74b94f0e93a1
parent 2d861e87
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ import android.text.Layout.Directions;
     */
    public static Directions directions(int dir, byte[] levels, int lstart,
            char[] chars, int cstart, int len) {
        if (len == 0) {
            return Layout.DIRS_ALL_LEFT_TO_RIGHT;
        }

        int baseLevel = dir == Layout.DIR_LEFT_TO_RIGHT ? 0 : 1;
        int curLevel = levels[lstart];