update SkPathRef bounds validation
1) print out that there is a problem and
what that problem is
2) switch to %g so we can see very small points
3) return false when the bounds aren't valid
Bug: oss-fuzz:10488
Change-Id: I2a8a5611ba6459f1bd45e29a1f20510401e86f76
Reviewed-on: https://skia-review.googlesource.com/156662
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 495f29b..4427299 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -891,14 +891,15 @@
#ifdef SK_DEBUG
if (fPoints[i].isFinite() &&
((point < leftTop).anyTrue() || (point > rightBot).anyTrue())) {
- SkDebugf("bounds: %f %f %f %f\n",
+ SkDebugf("bad SkPathRef bounds: %g %g %g %g\n",
fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBottom);
for (int j = 0; j < fPointCnt; ++j) {
if (i == j) {
- SkDebugf("*");
+ SkDebugf("*** bounds do not contain: ");
}
- SkDebugf("%f %f\n", fPoints[j].fX, fPoints[j].fY);
+ SkDebugf("%g %g\n", fPoints[j].fX, fPoints[j].fY);
}
+ return false;
}
#endif