aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-08-10 05:45:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-10 05:45:50 -0700
commitc52310402c56e535e574a0a53e2355e5350e952d (patch)
treef92fd173158b15c7b4196b5c63e8339f47274a1e /src/effects/gradients
parent75ccdc77a70ec2083141bf9ba98eb2f01ece2479 (diff)
Prevent degenerate linear gradient instantiation
If the point distance exceeds SkScalar, nasty things tend to happen. R=reed@google.com BUG=636194 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2234663002 Review-Url: https://codereview.chromium.org/2234663002
Diffstat (limited to 'src/effects/gradients')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 710bde826e..820c5b225d 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -790,7 +790,7 @@ sk_sp<SkShader> SkGradientShader::MakeLinear(const SkPoint pts[2],
SkShader::TileMode mode,
uint32_t flags,
const SkMatrix* localMatrix) {
- if (!pts) {
+ if (!pts || !SkScalarIsFinite((pts[1] - pts[0]).length())) {
return nullptr;
}
if (!valid_grad(colors, pos, colorCount, mode)) {