diff options
author | Seigo Nonaka <nona@google.com> | 2018-07-19 16:22:02 -0700 |
---|---|---|
committer | Tim Schumacher <timschumi@gmx.de> | 2019-01-27 11:15:51 +0100 |
commit | f4cc356cfd45ff6c2e5ad12e70d7a872720bbe96 (patch) | |
tree | cb103704713561c6682935491f1f8e884c6cee2c | |
parent | a25a47e90b5f104fee0dead82155bfbb571fba47 (diff) | |
download | frameworks_base-f4cc356cfd45ff6c2e5ad12e70d7a872720bbe96.tar.gz frameworks_base-f4cc356cfd45ff6c2e5ad12e70d7a872720bbe96.tar.bz2 frameworks_base-f4cc356cfd45ff6c2e5ad12e70d7a872720bbe96.zip |
Fix crash during cursor moving on BiDi text
The crash was introduced by Ib66ef392c19c937718e7101f6d48fac3abe51ad0
The root cause of the crashing is requesting out-of-line access for the
horizontal width. This invalid access is silently ignored by
TextLine#measure() method but new implementation end up with out of
bounds access.
To makes behavior as old implementation, calling getHorizontal instead
of accessing measured result array.
Bug: 78464361, 111580019
Test: Manually done
Change-Id: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
(cherry picked from commit 960647d582911ae7ab8b9491097898e6c313aaf1)
Merged-In: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
(cherry picked from commit a1076fdaa54ebf56bb32bea43fb278f7470ff307)
-rw-r--r-- | core/java/android/text/Layout.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index e1ad64fd075..dd82884d0f8 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -1362,7 +1362,8 @@ public abstract class Layout { } float get(final int offset) { - if (mHorizontals == null) { + if (mHorizontals == null || offset < mLineStartOffset + || offset >= mLineStartOffset + mHorizontals.length) { return getPrimaryHorizontal(offset); } else { return mHorizontals[offset - mLineStartOffset]; |