summaryrefslogtreecommitdiff
path: root/external/jpeg-turbo
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-07 10:40:37 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-07 10:41:03 +0100
commit01c7e2c246e231d70bb7c1c9b5ad7fd5e4614951 (patch)
treeace345f6e6edfb1c9e15243e65b6347c4afd89a4 /external/jpeg-turbo
parent4e89a3e012458fd123d8a962e16aad2838286f36 (diff)
external/jpeg-turbo: Work around -fsanitize=shift
Change-Id: I9ba85592a0d4d2052dd05abb8f4d2976ec1c95cc
Diffstat (limited to 'external/jpeg-turbo')
-rw-r--r--external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk3
-rw-r--r--external/jpeg-turbo/ubsan.patch31
2 files changed, 34 insertions, 0 deletions
diff --git a/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk b/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk
index 2cb2aa44a627..7f974228d5d0 100644
--- a/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk
+++ b/external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk
@@ -11,9 +11,12 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,jpeg-turbo))
$(eval $(call gb_UnpackedTarball_set_tarball,jpeg-turbo,$(JPEG_TURBO_TARBALL)))
+$(eval $(call gb_UnpackedTarball_set_patchlevel,jpeg-turbo,0))
+
$(eval $(call gb_UnpackedTarball_add_patches,jpeg-turbo,\
external/jpeg-turbo/jpeg-turbo.build.patch.1 \
$(if $(filter WNT,$(OS)),external/jpeg-turbo/jpeg-turbo.win_build.patch.1) \
+ external/jpeg-turbo/ubsan.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/jpeg-turbo/ubsan.patch b/external/jpeg-turbo/ubsan.patch
new file mode 100644
index 000000000000..fcd5bcf85cbb
--- /dev/null
+++ b/external/jpeg-turbo/ubsan.patch
@@ -0,0 +1,31 @@
+--- jdhuff.c
++++ jdhuff.c
+@@ -489,7 +489,7 @@
+ #define AVOID_TABLES
+ #ifdef AVOID_TABLES
+
+-#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((-1)<<(s)) + 1)))
++#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((unsigned)-1<<(s)) + 1)))
+
+ #else
+
+--- jdphuff.c
++++ jdphuff.c
+@@ -201,7 +201,7 @@
+ #define AVOID_TABLES
+ #ifdef AVOID_TABLES
+
+-#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
++#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((unsigned)-1<<(s)) + 1) : (x))
+
+ #else
+
+@@ -334,7 +334,7 @@
+ s += state.last_dc_val[ci];
+ state.last_dc_val[ci] = s;
+ /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
+- (*block)[0] = (JCOEF) (s << Al);
++ (*block)[0] = (JCOEF) ((unsigned)s << Al);
+ }
+
+ /* Completed MCU, so update state */