aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-05-13 13:36:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-13 18:05:16 +0000
commitb06a1eb4e5793b5053981cc76c72c497650c0e1a (patch)
treee2dd470121cf18caac62bc68b95d741acc5fee2c
parentec48812c5a5416595d97745715a6cd10ad60fc33 (diff)
detect overflow for morphology
Bug: oss-fuzz:8236 Change-Id: Iae911d995cbfed77c5d332f615da1a8d9b487c21 Reviewed-on: https://skia-review.googlesource.com/127703 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--src/core/SkImageFilter.cpp4
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 015b77c42c..2a898fda14 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -425,8 +425,8 @@ sk_sp<SkSpecialImage> SkImageFilter::applyCropRect(const Context& ctx,
} else {
sk_sp<SkSpecialImage> img(pad_image(src, ctx.outputProperties(),
bounds->width(), bounds->height(),
- srcOffset->x() - bounds->x(),
- srcOffset->y() - bounds->y()));
+ Sk32_sat_sub(srcOffset->x(), bounds->x()),
+ Sk32_sat_sub(srcOffset->y(), bounds->y())));
*srcOffset = SkIPoint::Make(bounds->x(), bounds->y());
return img;
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 9b81b45a6f..6ee409ef06 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -457,7 +457,7 @@ static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
middleSrcRect.inset(0, radius);
middleDstRect.inset(0, radius);
}
- if (middleSrcRect.fLeft - middleSrcRect.fRight >= 0) {
+ if (middleSrcRect.width() <= 0) {
// radius covers srcRect; use bounds over entire draw
apply_morphology_rect(renderTargetContext, clip, std::move(textureProxy),
srcRect, dstRect, radius, morphType, bounds, direction);