aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2018-04-03 10:15:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-03 15:27:00 +0000
commitb88045bdc24095bc9370c9166ac1d9ee062e116f (patch)
tree7f8709a98d8caa0470c9e2d06decc081c15ae706
parent08c39fcbcb68f5b0081ec69b4f5bd3c8dff23f9f (diff)
Catch infinite numbers in computeMatrices
Bug: skia:7433 Change-Id: I54ec095a2e6a3596f99e3659c947c6489a68ff47 Reviewed-on: https://skia-review.googlesource.com/118164 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
-rw-r--r--src/core/SkScalerContext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 96a0f80d7d..d529db9eb0 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -675,8 +675,10 @@ bool SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector
// All underlying ports have issues with zero text size, so use the matricies to zero.
// If one of the scale factors is less than 1/256 then an EM filling square will
// never affect any pixels.
+ // If there are any nonfinite numbers in the matrix, bail out and set the matrices to zero.
if (SkScalarAbs(GA.get(SkMatrix::kMScaleX)) <= SK_ScalarNearlyZero ||
- SkScalarAbs(GA.get(SkMatrix::kMScaleY)) <= SK_ScalarNearlyZero)
+ SkScalarAbs(GA.get(SkMatrix::kMScaleY)) <= SK_ScalarNearlyZero ||
+ !GA.isFinite())
{
s->fX = SK_Scalar1;
s->fY = SK_Scalar1;