From 69fcbccf476ffc55af4da4dfedc72c3de8f91ce8 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 30 Nov 2012 15:29:15 -0800 Subject: Fix crash in TextDropShadowCache The lengths used to copy/read arrays were completely wrong. Change-Id: If21f23a73cce59bbd32975760e6d728eeeb9e40d --- libs/hwui/TextDropShadowCache.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libs/hwui/TextDropShadowCache.cpp') diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp index 4d80f7382318..9c7a5ab3d077 100644 --- a/libs/hwui/TextDropShadowCache.cpp +++ b/libs/hwui/TextDropShadowCache.cpp @@ -30,7 +30,7 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// hash_t ShadowText::hash() const { - uint32_t charCount = len * sizeof(char16_t); + uint32_t charCount = len / sizeof(char16_t); uint32_t hash = JenkinsHashMix(0, len); hash = JenkinsHashMix(hash, android::hash_type(radius)); hash = JenkinsHashMix(hash, android::hash_type(textSize)); @@ -38,9 +38,13 @@ hash_t ShadowText::hash() const { hash = JenkinsHashMix(hash, flags); hash = JenkinsHashMix(hash, android::hash_type(italicStyle)); hash = JenkinsHashMix(hash, android::hash_type(scaleX)); - hash = JenkinsHashMixShorts(hash, text, charCount); - for (uint32_t i = 0; i < charCount * 2; i++) { - hash = JenkinsHashMix(hash, android::hash_type(positions[i])); + if (text) { + hash = JenkinsHashMixShorts(hash, text, charCount); + } + if (positions) { + for (uint32_t i = 0; i < charCount * 2; i++) { + hash = JenkinsHashMix(hash, android::hash_type(positions[i])); + } } return JenkinsHashWhiten(hash); } -- cgit v1.2.3-59-g8ed1b