summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Mok <kmok@cyngn.com>2016-07-13 14:45:16 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-07-26 16:01:35 -0700
commit859b6ef7fbdbed68fe84617281f200852b759b02 (patch)
tree438e2c0c1b22cfecb3bc1372eaaa1ea9103a531d
parent8a13735391da26ce021061d213a0d4c1a74caac1 (diff)
downloadandroid_frameworks_base-859b6ef7fbdbed68fe84617281f200852b759b02.tar.gz
android_frameworks_base-859b6ef7fbdbed68fe84617281f200852b759b02.tar.bz2
android_frameworks_base-859b6ef7fbdbed68fe84617281f200852b759b02.zip
Fix random crash in libhwui
On some cases (noticed from log) that there is a crash in libhwui.so, future debug log shows that the light center position values are nan, causing an out of bound access in hull function in SpotShadow.cpp for parameter retPoly which assume to be of maximum length of pointsLength only but not the case when all points are nan. More log shows that a Snapshot was created (new) without mRelativeLightCenter begin set, and Layer.cpp trying to use it by calling updateLightPosFromRenderer. Those values are random values in stack which causing math calc based on that value returning nan also. Initialize mRelativeLightCenter to 0 in Snapshot.cpp to avoid the problem. FEIJ-1515, FEIJ-1573, FEIJ-1575, FEIJ-1589 Change-Id: I9e24f6f1f856d053d09db1b1aae100f219f2a6de (cherry picked from commit de7ee4c9efb8ba1cddc6bd79122b4a4a4bda6866)
-rw-r--r--libs/hwui/Snapshot.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp
index beb2e1d0481..3da3a572fd0 100644
--- a/libs/hwui/Snapshot.cpp
+++ b/libs/hwui/Snapshot.cpp
@@ -40,6 +40,7 @@ Snapshot::Snapshot()
, mClipArea(&mClipAreaRoot) {
transform = &mTransformRoot;
region = nullptr;
+ mRelativeLightCenter.x = mRelativeLightCenter.y = mRelativeLightCenter.z = 0;
}
/**