summaryrefslogtreecommitdiff
path: root/external/libjpeg-turbo/ubsan.patch
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-25 09:53:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-25 16:00:25 +0200
commit35bb14d8573d29d836a6ff8d64b06fa820e50d11 (patch)
tree60dac86e72239e3c914456024b2d1fd65c8148b4 /external/libjpeg-turbo/ubsan.patch
parentffb19c5be464770e6ac2d9b13422353c8a03294b (diff)
ofz#3782 libjpeg ubsan woes
https://github.com/libjpeg-turbo/libjpeg-turbo/issues/171 Change-Id: Ic6d7e27f88a542d78f3257418099c8fd875b04c9 Reviewed-on: https://gerrit.libreoffice.org/43812 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'external/libjpeg-turbo/ubsan.patch')
-rw-r--r--external/libjpeg-turbo/ubsan.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/external/libjpeg-turbo/ubsan.patch b/external/libjpeg-turbo/ubsan.patch
index 81ff148c57d6..33d3c15a8b3c 100644
--- a/external/libjpeg-turbo/ubsan.patch
+++ b/external/libjpeg-turbo/ubsan.patch
@@ -17,3 +17,23 @@
put_bits -= 8;
}
+--- jdarith.c
++++ jdarith.c
+@@ -306,7 +306,7 @@
+ while (m >>= 1)
+ if (arith_decode(cinfo, st)) v |= m;
+ v += 1; if (sign) v = -v;
+- entropy->last_dc_val[ci] += v;
++ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
+ }
+
+ /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
+@@ -564,7 +564,7 @@
+ while (m >>= 1)
+ if (arith_decode(cinfo, st)) v |= m;
+ v += 1; if (sign) v = -v;
+- entropy->last_dc_val[ci] += v;
++ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
+ }
+
+ if (block)