Protect against nans causing infinite recursion in GrPathUtils::convertCubicToQuads

Bug: skia:7427
Change-Id: I72426574be20cd41981bbb8366bda039443aa606
Reviewed-on: https://skia-review.googlesource.com/87302
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2017-12-19 16:27:56 -05:00 committed by Skia Commit-Bot
parent 0a241ce808
commit 27d9365d9a

View File

@ -540,6 +540,9 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
void GrPathUtils::convertCubicToQuads(const SkPoint p[4], void GrPathUtils::convertCubicToQuads(const SkPoint p[4],
SkScalar tolScale, SkScalar tolScale,
SkTArray<SkPoint, true>* quads) { SkTArray<SkPoint, true>* quads) {
if (!p[0].isFinite() || !p[1].isFinite() || !p[2].isFinite() || !p[3].isFinite()) {
return;
}
SkPoint chopped[10]; SkPoint chopped[10];
int count = SkChopCubicAtInflections(p, chopped); int count = SkChopCubicAtInflections(p, chopped);
@ -557,6 +560,9 @@ void GrPathUtils::convertCubicToQuadsConstrainToTangents(const SkPoint p[4],
SkScalar tolScale, SkScalar tolScale,
SkPathPriv::FirstDirection dir, SkPathPriv::FirstDirection dir,
SkTArray<SkPoint, true>* quads) { SkTArray<SkPoint, true>* quads) {
if (!p[0].isFinite() || !p[1].isFinite() || !p[2].isFinite() || !p[3].isFinite()) {
return;
}
SkPoint chopped[10]; SkPoint chopped[10];
int count = SkChopCubicAtInflections(p, chopped); int count = SkChopCubicAtInflections(p, chopped);