Skip to content

Commit 3df0159

Browse files
Gilles DebunneAndroid (Google) Code Review
authored andcommitted
Merge "Fix for AOOB in MeasuredText"
2 parents a54b964 + ba3634f commit 3df0159

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)