changeset 6852:9305a30e8313

Fix to RT-36485: Uninitialised memory in rt/modules/graphics/src/main/native-iio/libjpeg7 Reviewed by kcr
author Chien Yang <chien.yang@oracle.com>
date Wed, 23 Apr 2014 21:59:39 -0700
parents f6df8ad44807
children 10f1851853d7
files modules/graphics/src/main/native-iio/libjpeg7/jchuff.c modules/graphics/src/main/native-iio/libjpeg7/jcmaster.c modules/graphics/src/main/native-iio/libjpeg7/jdhuff.c
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-iio/libjpeg7/jchuff.c	Wed Apr 23 21:32:43 2014 -0700
+++ b/modules/graphics/src/main/native-iio/libjpeg7/jchuff.c	Wed Apr 23 21:59:39 2014 -0700
@@ -179,6 +179,9 @@
   unsigned int huffcode[257];
   unsigned int code;
 
+  MEMZERO(huffsize, SIZEOF(huffsize));
+  MEMZERO(huffcode, SIZEOF(huffcode));
+
   /* Note that huffsize[] and huffcode[] are filled in code-length order,
    * paralleling the order of the symbols themselves in htbl->huffval[].
    */
@@ -790,6 +793,8 @@
   JBLOCKROW block;
   int absvalues[DCTSIZE2];
 
+  MEMZERO(absvalues, SIZEOF(absvalues));
+
   entropy->next_output_byte = cinfo->dest->next_output_byte;
   entropy->free_in_buffer = cinfo->dest->free_in_buffer;
 
--- a/modules/graphics/src/main/native-iio/libjpeg7/jcmaster.c	Wed Apr 23 21:32:43 2014 -0700
+++ b/modules/graphics/src/main/native-iio/libjpeg7/jcmaster.c	Wed Apr 23 21:59:39 2014 -0700
@@ -320,8 +320,11 @@
   int * last_bitpos_ptr;
   int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
   /* -1 until that coefficient has been seen; then last Al for it */
+  MEMZERO(last_bitpos, SIZEOF(last_bitpos));
 #endif
 
+  MEMZERO(component_sent, SIZEOF(component_sent));
+
   if (cinfo->num_scans <= 0)
     ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
 
--- a/modules/graphics/src/main/native-iio/libjpeg7/jdhuff.c	Wed Apr 23 21:32:43 2014 -0700
+++ b/modules/graphics/src/main/native-iio/libjpeg7/jdhuff.c	Wed Apr 23 21:59:39 2014 -0700
@@ -285,6 +285,9 @@
   unsigned int huffcode[257];
   unsigned int code;
 
+  MEMZERO(huffsize, SIZEOF(huffsize));
+  MEMZERO(huffcode, SIZEOF(huffcode));
+
   /* Note that huffsize[] and huffcode[] are filled in code-length order,
    * paralleling the order of the symbols themselves in htbl->huffval[].
    */