summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2011-10-03 09:56:39 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-03 09:56:39 -0700
commit8ebf1efd66516340bedbf0d0a19d5e96cc28fa20 (patch)
treeb5ef9727339aa117e65635924fed866e8045a6cf /core/jni
parenteb3b750c1df8429f88ba28dc3bf02b28dee9ca40 (diff)
parent155fa38a71ff11e1617b1e3dfda770543df8eb1d (diff)
downloadframeworks_base-8ebf1efd66516340bedbf0d0a19d5e96cc28fa20.zip
frameworks_base-8ebf1efd66516340bedbf0d0a19d5e96cc28fa20.tar.gz
frameworks_base-8ebf1efd66516340bedbf0d0a19d5e96cc28fa20.tar.bz2
Merge "Fix potential issue with the TextLayoutCache with glyphs"
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 3c70c30..9ba95bd 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -626,7 +626,9 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si
return;
}
*outStartIndex = mLogClusters[start];
- *outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1;
+ size_t endIndex = (start + count >= mAdvances.size()) ?
+ mGlyphs.size() : mLogClusters[start + count];
+ *outGlyphsCount = endIndex - *outStartIndex;
#if DEBUG_GLYPHS
LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count,
*outStartIndex, *outGlyphsCount);