Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: include/effects/SkLightingImageFilter.h

Issue 22799007: I'm investigating how to make the IPC transfer a bit more secure on the (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: New fuzzer added Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/effects/SkLightingImageFilter.h
diff --git a/include/effects/SkLightingImageFilter.h b/include/effects/SkLightingImageFilter.h
index 07f713b0af44272f830319475c5312b339ab72f2..9c90cd949bc2f94718befdadf6d945f37dbc7c30 100644
--- a/include/effects/SkLightingImageFilter.h
+++ b/include/effects/SkLightingImageFilter.h
@@ -26,7 +26,8 @@ public:
return fX > fY ? (fX > fZ ? fX : fZ) : (fY > fZ ? fY : fZ);
}
void normalize() {
- SkScalar scale = SkScalarInvert(SkScalarSqrt(dot(*this)));
+ // Small epsilon is added to prevent division by 0.
+ SkScalar scale = SkScalarInvert(SkScalarSqrt(dot(*this)) + SK_ScalarNearlyZero);
fX = SkScalarMul(fX, scale);
fY = SkScalarMul(fY, scale);
fZ = SkScalarMul(fZ, scale);

Powered by Google App Engine
This is Rietveld 408576698