Fix int32 overflow in LinearGradientContext::shade4_dx_clamp
authorfmalita <fmalita@chromium.org>
Thu, 26 May 2016 18:13:52 +0000 (11:13 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 26 May 2016 18:13:52 +0000 (11:13 -0700)
commit7b38e3cf75296c749c843fa89af14f70f4e4b2db
tree04907815dd6f68db55ee9df0958ab5549a801a1e
parent0e5b249e549a540bd89d525369b950c9e4404235
Fix int32 overflow in LinearGradientContext::shade4_dx_clamp

The unconditional increment in shade4_dx_clamp can overflow int32

=> n == SK_MinS32
=> count ~= SK_MinS32
=> we skip the main shader loop 'cause count < 0

R=reed@google.com,mtklein@google.com
BUG=chromium:599458
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2010843002

Review-Url: https://codereview.chromium.org/2010843002
src/effects/gradients/SkLinearGradient.cpp
tests/GradientTest.cpp