diff options
author | caryclark <caryclark@google.com> | 2016-10-04 13:06:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-04 13:06:17 -0700 |
commit | 6942442ef7cc018ac136dd379ad6a30902a060e5 (patch) | |
tree | 45d0a07c65707e427eecd7e28907cad9b563bb70 /src/core/SkPathRef.cpp | |
parent | 56df2de7fb48e879446938f47464c7a2c8223616 (diff) |
disallow -4 pointer
A user's homegrown unsigned integer overflow tool
complains if a nullptr is decremented.
The conicWeight pointer likes to predecrement
before walking, but this is unnecessary if
its value is nullptr.
R=reed@google.com
BUG=skia:5415
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2061833005
Review-Url: https://codereview.chromium.org/2061833005
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r-- | src/core/SkPathRef.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index 06a1519872..e5efefcceb 100644 --- a/src/core/SkPathRef.cpp +++ b/src/core/SkPathRef.cpp @@ -619,7 +619,10 @@ void SkPathRef::Iter::setPathRef(const SkPathRef& path) { fPts = path.points(); fVerbs = path.verbs(); fVerbStop = path.verbsMemBegin(); - fConicWeights = path.conicWeights() - 1; // begin one behind + fConicWeights = path.conicWeights(); + if (fConicWeights) { + fConicWeights -= 1; // begin one behind + } } uint8_t SkPathRef::Iter::next(SkPoint pts[4]) { |