Add some checks to GrDashOp

Bug: oss-fuzz:9322
Change-Id: I9d40e85814138fd83efa497e00c0d612cc26043e
Reviewed-on: https://skia-review.googlesource.com/158821
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2018-10-02 13:05:38 -04:00 committed by Skia Commit-Bot
parent 81c8a20112
commit f86073a131
2 changed files with 8 additions and 0 deletions

View File

@ -1590,6 +1590,10 @@ void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip& clip,
RETURN_IF_ABANDONED RETURN_IF_ABANDONED
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "internalDrawPath", fContext); GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "internalDrawPath", fContext);
if (!viewMatrix.isFinite() || !originalShape.bounds().isFinite()) {
return;
}
SkIRect clipConservativeBounds; SkIRect clipConservativeBounds;
clip.getConservativeBounds(this->width(), this->height(), &clipConservativeBounds, nullptr); clip.getConservativeBounds(this->width(), this->height(), &clipConservativeBounds, nullptr);

View File

@ -793,6 +793,10 @@ std::unique_ptr<GrDrawOp> GrDashOp::MakeDashLineOp(GrContext* context,
// Scale corrections of intervals and stroke from view matrix // Scale corrections of intervals and stroke from view matrix
calc_dash_scaling(&lineData.fParallelScale, &lineData.fPerpendicularScale, viewMatrix, calc_dash_scaling(&lineData.fParallelScale, &lineData.fPerpendicularScale, viewMatrix,
lineData.fPtsRot); lineData.fPtsRot);
if (SkScalarNearlyZero(lineData.fParallelScale) ||
SkScalarNearlyZero(lineData.fPerpendicularScale)) {
return nullptr;
}
SkScalar offInterval = intervals[1] * lineData.fParallelScale; SkScalar offInterval = intervals[1] * lineData.fParallelScale;
SkScalar strokeWidth = lineData.fSrcStrokeWidth * lineData.fPerpendicularScale; SkScalar strokeWidth = lineData.fSrcStrokeWidth * lineData.fPerpendicularScale;