Blame SOURCES/libjpeg-turbo-CVE-2018-11813.patch

8703cb
From ac483bbac827694aef13a179c1bffcb2a3dc32b8 Mon Sep 17 00:00:00 2001
8703cb
From: DRC <information@libjpeg-turbo.org>
8703cb
Date: Tue, 12 Jun 2018 16:08:26 -0500
8703cb
Subject: [PATCH] Fix CVE-2018-11813
8703cb
8703cb
Fixed an issue (CVE-2018-11813) whereby a specially-crafted malformed input
8703cb
file (specifically, a file with a valid Targa header but incomplete pixel data)
8703cb
would cause cjpeg to generate a JPEG file that was potentially thousands of
8703cb
times larger than the input file.  The Targa reader in cjpeg was not properly
8703cb
detecting that the end of the input file had been reached prematurely, so after
8703cb
all valid pixels had been read from the input, the reader injected dummy pixels
8703cb
with values of 255 into the JPEG compressor until the number of pixels
8703cb
specified in the Targa header had been compressed.  The Targa reader in cjpeg
8703cb
now behaves like the PPM reader and aborts compression if the end of the input
8703cb
file is reached prematurely.  Because this issue only affected cjpeg and not
8703cb
the underlying library, and because it did not involve any out-of-bounds reads
8703cb
or other exploitable behaviors, it was not believed to represent a security
8703cb
threat.
8703cb
---
8703cb
 rdtarga.c | 6 ++----
8703cb
 1 file changed, 2 insertions(+), 4 deletions(-)
8703cb
8703cb
diff --git a/rdtarga.c b/rdtarga.c
8703cb
index b9bbd07..f874ece 100644
8703cb
--- a/rdtarga.c
8703cb
+++ b/rdtarga.c
8703cb
@@ -125,11 +125,10 @@ METHODDEF(void)
8703cb
 read_non_rle_pixel (tga_source_ptr sinfo)
8703cb
 /* Read one Targa pixel from the input file; no RLE expansion */
8703cb
 {
8703cb
-  register FILE *infile = sinfo->pub.input_file;
8703cb
   register int i;
8703cb
 
8703cb
   for (i = 0; i < sinfo->pixel_size; i++) {
8703cb
-    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
8703cb
+    sinfo->tga_pixel[i] = (U_CHAR) read_byte(sinfo);
8703cb
   }
8703cb
 }
8703cb
 
8703cb
@@ -138,7 +137,6 @@ METHODDEF(void)
8703cb
 read_rle_pixel (tga_source_ptr sinfo)
8703cb
 /* Read one Targa pixel from the input file, expanding RLE data as needed */
8703cb
 {
8703cb
-  register FILE *infile = sinfo->pub.input_file;
8703cb
   register int i;
8703cb
 
8703cb
   /* Duplicate previously read pixel? */
8703cb
@@ -160,7 +158,7 @@ read_rle_pixel (tga_source_ptr sinfo)
8703cb
 
8703cb
   /* Read next pixel */
8703cb
   for (i = 0; i < sinfo->pixel_size; i++) {
8703cb
-    sinfo->tga_pixel[i] = (U_CHAR) getc(infile);
8703cb
+    sinfo->tga_pixel[i] = (U_CHAR) read_byte(sinfo);
8703cb
   }
8703cb
 }
8703cb
 
8703cb
-- 
8703cb
2.17.1
8703cb