summaryrefslogtreecommitdiff
path: root/external/lcms2/ubsan.patch.0
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-11-11 10:26:12 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-11-11 10:40:50 +0100
commitaf0605ce4511b1248810ced538d9f9f62e74d7d7 (patch)
treedbd34803405b83e1020ec507a8ce3dec5df3748c /external/lcms2/ubsan.patch.0
parent205044e89722e9b3a9c700ee3ae6f2335f57ef7b (diff)
Avoid -fsanitize=signed-integer-overflow
Change-Id: I1a8ae99401e488e2ece47be4119843945154ef98
Diffstat (limited to 'external/lcms2/ubsan.patch.0')
-rw-r--r--external/lcms2/ubsan.patch.011
1 files changed, 11 insertions, 0 deletions
diff --git a/external/lcms2/ubsan.patch.0 b/external/lcms2/ubsan.patch.0
new file mode 100644
index 000000000000..2eafcad39696
--- /dev/null
+++ b/external/lcms2/ubsan.patch.0
@@ -0,0 +1,11 @@
+--- src/lcms2_internal.h
++++ src/lcms2_internal.h
+@@ -93,7 +93,7 @@
+
+ // A fast way to convert from/to 16 <-> 8 bits
+ #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb))
+-#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((rgb) * 65281 + 8388608) >> 24) & 0xFF)
++#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((unsigned)(rgb) * 65281 + 8388608) >> 24) & 0xFF)
+
+ // Code analysis is broken on asserts
+ #ifdef _MSC_VER