aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-02-15 11:17:56 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-15 17:14:19 +0000
commit36c0b57698a2e1fd181e5f1569fbf70cd695e9b8 (patch)
tree471296ebdf463a74a681373f2747434520330c19 /include
parentacf939ab58774593b49b2335369241bacffa0598 (diff)
use safe increment for edge walker
Bug: oss-fuzz:6126 Change-Id: I8f6865cbbbfbe37acf940cc2d4ae93204ba7168d Reviewed-on: https://skia-review.googlesource.com/107783 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/private/SkSafe32.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/private/SkSafe32.h b/include/private/SkSafe32.h
index 40d4121b52..25058d2c76 100644
--- a/include/private/SkSafe32.h
+++ b/include/private/SkSafe32.h
@@ -22,6 +22,9 @@ static constexpr int32_t Sk32_sat_sub(int32_t a, int32_t b) {
// To avoid UBSAN complaints about 2's compliment overflows
//
+static constexpr int32_t Sk32_can_overflow_add(int32_t a, int32_t b) {
+ return (int32_t)((uint32_t)a + (uint32_t)b);
+}
static constexpr int32_t Sk32_can_overflow_sub(int32_t a, int32_t b) {
return (int32_t)((uint32_t)a - (uint32_t)b);
}