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>
This commit is contained in:
Kevin Lubick 2018-04-03 10:15:48 -04:00 committed by Skia Commit-Bot
parent 08c39fcbcb
commit b88045bdc2

View File

@ -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;