aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkPedanticMath.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-03 15:35:33 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-03 21:01:54 +0000
commit9fc53624a09f6d3378b0a540832571dc1c31fbcd (patch)
tree74e3ea18c10eafc1c4c104c6d1c7b48e70975c8e /include/private/SkPedanticMath.h
parent3a8a277d9364b6747ee16f55c70c974cd0f8d134 (diff)
check for irect with overflow width/height
Bug:798066 Change-Id: Iac324ac5a32fae241a528751c84279ce60ac4baf Reviewed-on: https://skia-review.googlesource.com/90544 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/private/SkPedanticMath.h')
-rw-r--r--include/private/SkPedanticMath.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/private/SkPedanticMath.h b/include/private/SkPedanticMath.h
new file mode 100644
index 0000000000..6d9c8a18be
--- /dev/null
+++ b/include/private/SkPedanticMath.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPedanticMath_DEFINED
+#define SkPedanticMath_DEFINED
+
+// To avoid UBSAN complaints about 2's compliment overflows
+//
+static inline int32_t SkSub32(int32_t a, int32_t b) {
+ return (int32_t)((uint32_t)a - (uint32_t)b);
+}
+
+#endif