Skip to content

Commit 8ebf1ef

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Fix potential issue with the TextLayoutCache with glyphs"
2 parents eb3b750 + 155fa38 commit 8ebf1ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/jni/android/graphics/TextLayoutCache.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,9 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si
626626
return;
627627
}
628628
*outStartIndex = mLogClusters[start];
629-
*outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1;
629+
size_t endIndex = (start + count >= mAdvances.size()) ?
630+
mGlyphs.size() : mLogClusters[start + count];
631+
*outGlyphsCount = endIndex - *outStartIndex;
630632
#if DEBUG_GLYPHS
631633
LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count,
632634
*outStartIndex, *outGlyphsCount);

0 commit comments

Comments
 (0)