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

Unified Diff: src/core/SkScan_AntiPath.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/SkScan_AntiPath.cpp
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 6ea6b8b07ea37e78ef79e752a1e34d4ddbf8a1f6..dad7ad62dfdf97b6e8330fd84afae3680fd1b337 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -545,7 +545,7 @@ void MaskSuperBlitter::blitH(int x, int y, int width) {
}
#endif
- x -= (fMask.fBounds.fLeft << SHIFT);
+ x -= fMask.fBounds.fLeft * (1 << SHIFT);
// hack, until I figure out why my cubics (I think) go beyond the bounds
if (x < 0) {
@@ -592,7 +592,7 @@ static bool fitsInsideLimit(const SkRect& r, SkScalar max) {
static int overflows_short_shift(int value, int shift) {
const int s = 16 + shift;
- return (value << s >> s) - value;
+ return (value * (1 << s) >> s) - value;
}
/**
« include/core/SkFixed.h ('K') | « src/core/SkMath.cpp ('k') | src/core/SkScan_Antihair.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698