diff options
author | Brian Salomon <bsalomon@google.com> | 2016-12-20 11:41:43 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-20 18:19:56 +0000 |
commit | c1c607e165b4306ff1fdc60139dce174019864a4 (patch) | |
tree | cb09c73dd795e290c1ce8603308d22c45353bbd7 | |
parent | 22c57abe439f200472a14b2341b68ed7c0ce785e (diff) |
GPU: Fix for fuzzer issue for sw-rendered paths with large bounds.
BUG=675315
Change-Id: Ida43ef878f89d0f327ef11d1c3e0df429d5760dd
Reviewed-on: https://skia-review.googlesource.com/6331
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 86fb5ea837..fc529ba51f 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -32,6 +32,14 @@ static bool get_unclipped_shape_dev_bounds(const GrShape& shape, const SkMatrix& } SkRect shapeDevBounds; matrix.mapRect(&shapeDevBounds, shapeBounds); + // Even though these are "unclipped" bounds we still clip to the int32_t range. + // This is the largest int32_t that is representable exactly as a float. The next 63 larger ints + // would round down to this value when cast to a float, but who really cares. + // INT32_MIN is exactly representable. + static constexpr int32_t kMaxInt = 2147483520; + if (!shapeDevBounds.intersect(SkRect::MakeLTRB(INT32_MIN, INT32_MIN, kMaxInt, kMaxInt))) { + return false; + } shapeDevBounds.roundOut(devBounds); return true; } |