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

Commit 1feba8bb authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Fix for an IOOBoundsException in Paint.

Bug 3331706

The temporary buffer starts at index 0 and shifts indexes by contextStart.
offset has to be changed accordingly.

Note that I didn't try to reproduce the monkey bug after this fix, but it
seems like a perfect explanation for the exception.

Change-Id: Ie69adc413670caed283bc46effc69f17a102922c
parent 270cbcc1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1690,7 +1690,7 @@ public class Paint {
        int contextLen = contextEnd - contextStart;
        char[] buf = TemporaryBuffer.obtain(contextLen);
        TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
        int result = getTextRunCursor(buf, 0, contextLen, flags, offset, cursorOpt);
        int result = getTextRunCursor(buf, 0, contextLen, flags, offset - contextStart, cursorOpt);
        TemporaryBuffer.recycle(buf);
        return result;
    }