Skip to content

Commit 26b4d62

Browse files
committed
Merge branch 'master' into dev
2 parents 9c6f79e + c0b16e3 commit 26b4d62

2 files changed

Lines changed: 32 additions & 24 deletions

File tree

ChangeLog.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ occurred when attempting to decompress grayscale JPEG images that were
7676
compressed with a sampling factor other than 1 (for instance, with
7777
`cjpeg -grayscale -sample 2x2`).
7878

79+
10. Fixed a regression introduced by 2.0.2[5] that caused the TurboJPEG API to
80+
incorrectly identify some JPEG images with unusual sampling factors as 4:4:4
81+
JPEG images. This was known to cause a buffer overflow when attempting to
82+
decompress some such images using `tjDecompressToYUV2()` or
83+
`tjDecompressToYUVPlanes()`.
84+
7985

8086
2.0.3
8187
=====
@@ -217,10 +223,11 @@ would produce a "Bogus message code" error message if the underlying bitmap and
217223
PPM readers/writers threw an error that was specific to the readers/writers
218224
(as opposed to a general libjpeg API error.)
219225

220-
4. Fixed an issue whereby a specially-crafted malformed BMP file, one in which
221-
the header specified an image width of 1073741824 pixels, would trigger a
222-
floating point exception (division by zero) in the `tjLoadImage()` function
223-
when attempting to load the BMP file into a 4-component image buffer.
226+
4. Fixed an issue (CVE-2018-1152) whereby a specially-crafted malformed BMP
227+
file, one in which the header specified an image width of 1073741824 pixels,
228+
would trigger a floating point exception (division by zero) in the
229+
`tjLoadImage()` function when attempting to load the BMP file into a
230+
4-component image buffer.
224231

225232
5. Fixed an issue whereby certain combinations of calls to
226233
`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite
@@ -234,10 +241,10 @@ a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
234241
7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD
235242
extensions if it detects that the compiler does not support DSPr2 instructions.
236243

237-
8. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
238-
a specially-crafted malformed color-index (8-bit-per-sample) BMP file in which
239-
some of the samples (color indices) exceeded the bounds of the BMP file's color
240-
table.
244+
8. Fixed out-of-bounds read in cjpeg (CVE-2018-14498) that occurred when
245+
attempting to compress a specially-crafted malformed color-index
246+
(8-bit-per-sample) BMP file in which some of the samples (color indices)
247+
exceeded the bounds of the BMP file's color table.
241248

242249
9. Fixed a signed integer overflow in the progressive Huffman decoder, detected
243250
by the Clang and GCC undefined behavior sanitizers, that could be triggered by
@@ -397,8 +404,8 @@ write scanlines in bottom-up order.) djpeg will now exit gracefully if an
397404
output format other than PPM/PGM, GIF, or Targa is selected along with the
398405
`-crop` option.
399406

400-
4. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color
401-
quantization was enabled.
407+
4. Fixed an issue (CVE-2017-15232) whereby `jpeg_skip_scanlines()` would
408+
segfault if color quantization was enabled.
402409

403410
5. TJBench (both C and Java versions) will now display usage information if any
404411
command-line argument is unrecognized. This prevents the program from silently
@@ -1025,13 +1032,13 @@ and IDCT algorithms (both are used during JPEG decompression.) For unknown
10251032
reasons (probably related to clang), this code cannot currently be compiled for
10261033
iOS.
10271034

1028-
15. Fixed an extremely rare bug that could cause the Huffman encoder's local
1029-
buffer to overrun when a very high-frequency MCU is compressed using quality
1030-
100 and no subsampling, and when the JPEG output buffer is being dynamically
1031-
resized by the destination manager. This issue was so rare that, even with a
1032-
test program specifically designed to make the bug occur (by injecting random
1033-
high-frequency YUV data into the compressor), it was reproducible only once in
1034-
about every 25 million iterations.
1035+
15. Fixed an extremely rare bug (CVE-2014-9092) that could cause the Huffman
1036+
encoder's local buffer to overrun when a very high-frequency MCU is compressed
1037+
using quality 100 and no subsampling, and when the JPEG output buffer is being
1038+
dynamically resized by the destination manager. This issue was so rare that,
1039+
even with a test program specifically designed to make the bug occur (by
1040+
injecting random high-frequency YUV data into the compressor), it was
1041+
reproducible only once in about every 25 million iterations.
10351042

10361043
16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG
10371044
compression functions was called repeatedly with the same
@@ -1066,8 +1073,9 @@ entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or
10661073
jpegtran, for instance) would result in an error, `Requested feature was
10671074
omitted at compile time`.
10681075

1069-
4. Fixed a couple of issues whereby malformed JPEG images would cause
1070-
libjpeg-turbo to use uninitialized memory during decompression.
1076+
4. Fixed a couple of issues (CVE-2013-6629 and CVE-2013-6630) whereby malformed
1077+
JPEG images would cause libjpeg-turbo to use uninitialized memory during
1078+
decompression.
10711079

10721080
5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred
10731081
when calling the TurboJPEG YUV encoding function with a very small (< 5x5)
@@ -1206,9 +1214,9 @@ correct behavior of the colorspace extensions when merged upsampling is used.
12061214
upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64
12071215
calling conventions.
12081216

1209-
4. Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG
1210-
images (specifically, images in which the component count was erroneously set
1211-
to a large value) would cause libjpeg-turbo to segfault.
1217+
4. Fixed a regression (CVE-2012-2806) caused by 1.2.0[6] whereby decompressing
1218+
corrupt JPEG images (specifically, images in which the component count was
1219+
erroneously set to a large value) would cause libjpeg-turbo to segfault.
12121220

12131221
5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU)
12141222
processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo

turbojpeg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ static int getSubsamp(j_decompress_ptr dinfo)
368368
D_MAX_BLOCKS_IN_MCU / pixelsize[i] && i == TJSAMP_444) {
369369
int match = 0;
370370
for (k = 1; k < dinfo->num_components; k++) {
371-
if (dinfo->comp_info[i].h_samp_factor ==
371+
if (dinfo->comp_info[k].h_samp_factor ==
372372
dinfo->comp_info[0].h_samp_factor &&
373-
dinfo->comp_info[i].v_samp_factor ==
373+
dinfo->comp_info[k].v_samp_factor ==
374374
dinfo->comp_info[0].v_samp_factor)
375375
match++;
376376
if (match == dinfo->num_components - 1) {

0 commit comments

Comments
 (0)