summaryrefslogtreecommitdiff
path: root/external/lcms2
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
parent205044e89722e9b3a9c700ee3ae6f2335f57ef7b (diff)
Avoid -fsanitize=signed-integer-overflow
Change-Id: I1a8ae99401e488e2ece47be4119843945154ef98
Diffstat (limited to 'external/lcms2')
-rw-r--r--external/lcms2/UnpackedTarball_lcms2.mk1
-rw-r--r--external/lcms2/ubsan.patch.011
2 files changed, 12 insertions, 0 deletions
diff --git a/external/lcms2/UnpackedTarball_lcms2.mk b/external/lcms2/UnpackedTarball_lcms2.mk
index fdf2ab3c6ae4..6490110fe6cb 100644
--- a/external/lcms2/UnpackedTarball_lcms2.mk
+++ b/external/lcms2/UnpackedTarball_lcms2.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,lcms2,\
external/lcms2/lcms2-msvc-disable-sse2.patch.1 \
external/lcms2/lcms2-vc2013-project.patch \
external/lcms2/lcms2-config-guess.patch.0 \
+ external/lcms2/ubsan.patch.0 \
))
# vim: set noet sw=4 ts=4:
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