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

Unified Diff: src/core/SkUtils.cpp

Issue 1503423003: ubsan shift fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add cast to work around win compiler 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
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | src/effects/gradients/SkClampRange.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkUtils.cpp
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index b3f698b4e7b1b35419ea4c5e210409581c23819e..f706cb9f25f55ad9f86a6fcfe2be7570a8a7f468 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -74,11 +74,11 @@ SkUnichar SkUTF8_ToUnichar(const char utf8[]) {
if (hic < 0) {
uint32_t mask = (uint32_t)~0x3F;
- hic <<= 1;
+ hic = SkLeftShift(hic, 1);
do {
c = (c << 6) | (*++p & 0x3F);
mask <<= 5;
- } while ((hic <<= 1) < 0);
+ } while ((hic = SkLeftShift(hic, 1)) < 0);
c &= ~mask;
}
return c;
@@ -95,11 +95,11 @@ SkUnichar SkUTF8_NextUnichar(const char** ptr) {
if (hic < 0) {
uint32_t mask = (uint32_t)~0x3F;
- hic <<= 1;
+ hic = SkLeftShift(hic, 1);
do {
c = (c << 6) | (*++p & 0x3F);
mask <<= 5;
- } while ((hic <<= 1) < 0);
+ } while ((hic = SkLeftShift(hic, 1)) < 0);
c &= ~mask;
}
*ptr = (char*)p + 1;
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | src/effects/gradients/SkClampRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698