check that rect is finite before jamming our bounds

Bug: skia:7507
Change-Id: I45ff36f96951f63795fdc09fdd8e3083865f6eda
Reviewed-on: https://skia-review.googlesource.com/101461
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp
index 6a588b7..d34214d 100644
--- a/tests/RectTest.cpp
+++ b/tests/RectTest.cpp
@@ -7,6 +7,7 @@
 
 #include "SkBitmap.h"
 #include "SkCanvas.h"
+#include "SkPath.h"
 #include "SkRect.h"
 #include "SkRectPriv.h"
 #include "Test.h"
@@ -95,6 +96,14 @@
     test_skbug4406(reporter);
 }
 
+DEF_TEST(Rect_path_nan, reporter) {
+    SkRect r = { 0, 0, SK_ScalarNaN, 100 };
+    SkPath p;
+    p.addRect(r);
+    // path normally just jams its bounds to be r, but it must notice that r is non-finite
+    REPORTER_ASSERT(reporter, !p.isFinite());
+}
+
 DEF_TEST(Rect_largest, reporter) {
     REPORTER_ASSERT(reporter, !SkRectPriv::MakeILarge().isEmpty());
     REPORTER_ASSERT(reporter,  SkRectPriv::MakeILargestInverted().isEmpty());