Bug 1229983 - verify that paths are finite in DrawTargetSkia::Stroke/Fill to handle Canvas paths containing infs. r=jmuizelaar

This commit is contained in:
Lee Salzman 2015-12-16 17:53:11 -05:00
parent 016ec296bf
commit cafcefe183
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.lineJoin = 'round';
ctx.transform(18.5, 41.6, 447, 78.2, 85.75, 120.5);
ctx.transform(186.25, 26.142857142857142, 251.5, -562949953421311, 147, 4.625);
ctx.rotate(32);
ctx.arc(33.8, 1, 183, 141.5, 452.5, 0);
ctx.transform(423, 24.75, 78, 12, 180.25, 191.5);
ctx.shadowBlur = 31.5;
ctx.shadowColor = "blue";
ctx.stroke();
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -25,5 +25,6 @@ load 1183363.html
load 1190705.html
load 1223740-1.html
load 1225381-1.html
load 1229983-1.html
load 1229932-1.html
load texImage2D.html

View File

@ -493,6 +493,10 @@ DrawTargetSkia::Stroke(const Path *aPath,
return;
}
if (!skiaPath->GetPath().isFinite()) {
return;
}
mCanvas->drawPath(skiaPath->GetPath(), paint.mPaint);
}
@ -543,6 +547,10 @@ DrawTargetSkia::Fill(const Path *aPath,
AutoPaintSetup paint(mCanvas.get(), aOptions, aPattern);
if (!skiaPath->GetPath().isFinite()) {
return;
}
mCanvas->drawPath(skiaPath->GetPath(), paint.mPaint);
}

View File

@ -201,6 +201,10 @@ PathSkia::StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
Rect
PathSkia::GetBounds(const Matrix &aTransform) const
{
if (!mPath.isFinite()) {
return Rect();
}
Rect bounds = SkRectToRect(mPath.getBounds());
return aTransform.TransformBounds(bounds);
}
@ -209,6 +213,10 @@ Rect
PathSkia::GetStrokedBounds(const StrokeOptions &aStrokeOptions,
const Matrix &aTransform) const
{
if (!mPath.isFinite()) {
return Rect();
}
SkPaint paint;
StrokeOptionsToPaint(paint, aStrokeOptions);