summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
Diffstat (limited to 'external')
-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)