[Libva] [PATCH 4/5] Fix size of array huffman_table to 2 instead 4.

Lim Siew Hoon siew.hoon.lim at intel.com
Tue Jun 28 11:35:56 UTC 2016


The size of array huffman_table only 2 in VAHuffmanTableBufferJPEGBaseline.
The index in 2..3 in huffman_table[x] will be access invalid memory
location.

Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
---
 test/decode/tinyjpeg-internal.h | 2 +-
 test/decode/tinyjpeg.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/decode/tinyjpeg-internal.h b/test/decode/tinyjpeg-internal.h
index 6801c31..74ad197 100644
--- a/test/decode/tinyjpeg-internal.h
+++ b/test/decode/tinyjpeg-internal.h
@@ -44,7 +44,7 @@ struct jdec_private;
 
 #define HUFFMAN_BITS_SIZE  256
 
-#define HUFFMAN_TABLES	   4
+#define HUFFMAN_TABLES	   2
 #define COMPONENTS	   4
 #define JPEG_MAX_WIDTH	   2048
 #define JPEG_MAX_HEIGHT	   2048
diff --git a/test/decode/tinyjpeg.c b/test/decode/tinyjpeg.c
index 6b5435d..103cba3 100644
--- a/test/decode/tinyjpeg.c
+++ b/test/decode/tinyjpeg.c
@@ -157,7 +157,7 @@ static int build_default_huffman_tables(struct jdec_private *priv)
     if (priv->default_huffman_table_initialized)
         return 0;
 
-    for (i = 0; i < 4; i++) {
+    for (i = 0; i < 2; i++) {
         priv->HTDC_valid[i] = 1;
         memcpy(priv->HTDC[i].bits, default_huffman_table_param.huffman_table[i].num_dc_codes,
                sizeof(default_huffman_table_param.huffman_table[i].num_dc_codes));
-- 
2.1.0



More information about the Libva mailing list