summaryrefslogtreecommitdiff
path: root/jchuff.c
diff options
context:
space:
mode:
authorJonathan Wright <jonathan.wright@arm.com>2020-08-05 11:42:22 +0100
committerJonathan Wright <jonathan.wright@arm.com>2020-08-07 17:04:34 +0100
commitdb870dfef8ab97950b4bdf22c66dd6c18326460b (patch)
tree9862c1aa45d014815ec798992ecb43eff1bc8d42 /jchuff.c
parent341272d909285da90e44015ca41f956fd00b9dd8 (diff)
Update libjpeg-turbo to v2.0.5
Update Chromium's copy of libjpeg-turbo to the latest stable upstream release (v2.0.5) and reapply our local changes documented in README.chromium. This update addresses three CVEs - CVE-2018-19664, CVE-2018-20330, CVE-2018-20330 - that do not affect Chromium. The fixes do, however, satisfy UBSan - allowing Chromium's libjpeg-turbo to be used in AOSP. Cherry-pick one additional change[1] from upstream to prevent AArch64 Windows builds from failing. [1] https://github.com/libjpeg-turbo/libjpeg-turbo/commit/6ee5d5f568fda1a7c6a49dd8995f2d89866ee42d Bug: 922430 Bug: https://issuetracker.google.com/135180511 Change-Id: I146fe82f7a016ce393eb0d37aebe0b7c2492a9da
Diffstat (limited to 'jchuff.c')
-rw-r--r--jchuff.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/jchuff.c b/jchuff.c
index 939b3e7..cb05055 100644
--- a/jchuff.c
+++ b/jchuff.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
+ * Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -43,8 +43,8 @@
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
-#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
-#if !defined __thumb__ || defined __thumb2__
+#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
+#if !defined(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
@@ -356,6 +356,8 @@ dump_buffer(working_state *state)
put_buffer = (put_buffer << size) | code; \
}
+#if SIZEOF_SIZE_T != 8 && !defined(_WIN64)
+
#define CHECKBUF15() { \
if (put_bits > 15) { \
EMIT_BYTE() \
@@ -363,6 +365,8 @@ dump_buffer(working_state *state)
} \
}
+#endif
+
#define CHECKBUF31() { \
if (put_bits > 31) { \
EMIT_BYTE() \
@@ -428,7 +432,7 @@ dump_buffer(working_state *state)
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
* larger than 200 bytes.
*/
-#define BUFSIZE (DCTSIZE2 * 4)
+#define BUFSIZE (DCTSIZE2 * 8)
#define LOAD_BUFFER() { \
if (state->free_in_buffer < BUFSIZE) { \