diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-11-02 12:09:55 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-02 18:12:36 +0000 |
commit | 430ad1f2065c182746e43e67ca95fb911cc55892 (patch) | |
tree | b3fd22f8c2ed5e5243c08372d10e38684138491d /src/gpu/GrSoftwarePathRenderer.cpp | |
parent | d7af1dbb64b764e1992b80e16236fe190531d59a (diff) |
Fix int overflow issues with clip and path bounds, take 2.
* Change IsInsideClip test to be more int overflow friendly
* Check to make sure path bounds can have representable width and height
Bug: skia:7239
Bug: skia:7240
Change-Id: If8468e46bc74a428c25d466ff3756d0cad385c09
Reviewed-on: https://skia-review.googlesource.com/66154
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/GrSoftwarePathRenderer.cpp')
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 4b0f363fee..ef7fa9078e 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -52,6 +52,11 @@ static bool get_unclipped_shape_dev_bounds(const GrShape& shape, const SkMatrix& if (!shapeDevBounds.intersect(SkRect::MakeLTRB(INT32_MIN, INT32_MIN, kMaxInt, kMaxInt))) { return false; } + // Make sure that the resulting SkIRect can have representable width and height + if (SkScalarRoundToInt(shapeDevBounds.width()) > kMaxInt || + SkScalarRoundToInt(shapeDevBounds.height()) > kMaxInt) { + return false; + } shapeDevBounds.roundOut(devBounds); return true; } |