Skip to content

Commit ba3634f

Browse files
author
Gilles Debunne
committed
Fix for AOOB in MeasuredText
Bug 5707593 Change-Id: I3c21343b2938119d7ae9d7892733dc83a209c991
1 parent a6b8fe1 commit ba3634f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/java/android/text/MeasuredText.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ void setPara(CharSequence text, int start, int end, TextDirectionHeuristic textD
109109
for (int i = 0; i < spans.length; i++) {
110110
int startInPara = spanned.getSpanStart(spans[i]) - start;
111111
int endInPara = spanned.getSpanEnd(spans[i]) - start;
112+
// The span interval may be larger and must be restricted to [start, end[
113+
if (startInPara < 0) startInPara = 0;
114+
if (endInPara > len) endInPara = len;
112115
for (int j = startInPara; j < endInPara; j++) {
113116
mChars[j] = '\uFFFC';
114117
}

0 commit comments

Comments
 (0)