Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: src/core/SkMath.cpp

Issue 1503423003: ubsan shift fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkMath.cpp
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp
index af93d7ecb2cf850f00745c01783ca123621606e4..57b27408dfe94b9b61727cacb1bb1378fcf697cc 100644
--- a/src/core/SkMath.cpp
+++ b/src/core/SkMath.cpp
@@ -72,8 +72,8 @@ int32_t SkDivBits(int32_t numer, int32_t denom, int shift_bias) {
return SkApplySign(SK_MaxS32, sign);
}
- denom <<= dbits;
- numer <<= nbits;
+ denom *= 1 << dbits;
+ numer *= 1 << nbits;
SkFixed result = 0;

Powered by Google App Engine
This is Rietveld 408576698