aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-08 17:17:47 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 17:36:27 +0000
commitfda4600e41ded0b8f0a54222e2dc8a85d53b4121 (patch)
tree59436090ce0bd63c36a5230aab4f78215dd43e33 /src
parent87345661516731e02c6087bfc8698316b36933fc (diff)
SkPerlinNoiseShader: handle pathological inputs
BUG=skia:6429 Change-Id: Ifc20c1f480c1396e40ab7fc3a3789aa7c2ae5d85 Reviewed-on: https://skia-review.googlesource.com/15896 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 72a26d5f6b..1f19326e52 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -357,6 +357,9 @@ SkScalar SkPerlinNoiseShader::PerlinNoiseShaderContext::noise2D(
int b11 = (j + noiseY.nextNoisePositionIntegerValue) & kBlockMask;
SkScalar sx = smoothCurve(noiseX.noisePositionFractionValue);
SkScalar sy = smoothCurve(noiseY.noisePositionFractionValue);
+ if (sx < 0 || sy < 0 || sx > 1 || sy > 1) {
+ return 0; // Check for pathological inputs.
+ }
// This is taken 1:1 from SVG spec: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement
SkPoint fractionValue = SkPoint::Make(noiseX.noisePositionFractionValue,
noiseY.noisePositionFractionValue); // Offset (0,0)