diff options
author | Cary Clark <caryclark@skia.org> | 2018-02-28 12:42:55 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-06 21:39:50 +0000 |
commit | a82780e09d1f2d7a57901d53700cdb7678f631d0 (patch) | |
tree | 812f4e02f547921d70b9bc0460daf810ff67e090 | |
parent | 61e2d45f0009cbdbf1046f57bbc08206f3f2bc28 (diff) |
use safe math for growForRepeatedVerb
R=reed@google.com
Bug: skia:7659
Change-Id: Ib1d2a2042830b56f559e4ff4eae97fd86a194bb9
Reviewed-on: https://skia-review.googlesource.com/111060
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
-rw-r--r-- | src/core/SkPathRef.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index c710f71ba9..cc6152a93d 100644 --- a/src/core/SkPathRef.cpp +++ b/src/core/SkPathRef.cpp @@ -563,8 +563,12 @@ SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb, } } - fVerbCnt += numVbs; - fPointCnt += pCnt; + SkSafeMath safe; + fVerbCnt = safe.addInt(fVerbCnt, numVbs); + fPointCnt = safe.addInt(fPointCnt, pCnt); + if (!safe) { + SK_ABORT("cannot grow path"); + } fFreeSpace -= space; fBoundsIsDirty = true; // this also invalidates fIsFinite if (dirtyAfterEdit) { |