diff options
author | 2017-04-07 10:46:39 -0400 | |
---|---|---|
committer | 2017-04-10 13:11:34 +0000 | |
commit | 1dd161c833927d61d436fed68a80b07e44c65226 (patch) | |
tree | 7de47854282f9e609a0f22c711ccdc4fd8fb1f95 /src | |
parent | 4c7754c499d092c8b81fe3c5119aebe4dcfd09f4 (diff) |
Fix infinite loop in SkRTree::insert()
When aspectRatio is not finite, insert() can fall into an infinite loop.
This happens if you pass SkRect::MakeLargest() to the factory as bounds.
BUG=skia:5974
Change-Id: Ibcc9e5c5943c718608d4c1448305f7b8f11413bc
Reviewed-on: https://skia-review.googlesource.com/11784
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkRTree.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp index bae2fdce3f..4d1787e70d 100644 --- a/src/core/SkRTree.cpp +++ b/src/core/SkRTree.cpp @@ -7,7 +7,8 @@ #include "SkRTree.h" -SkRTree::SkRTree(SkScalar aspectRatio) : fCount(0), fAspectRatio(aspectRatio) {} +SkRTree::SkRTree(SkScalar aspectRatio) + : fCount(0), fAspectRatio(isfinite(aspectRatio) ? aspectRatio : 1) {} SkRect SkRTree::getRootBound() const { if (fCount) { |