summaryrefslogtreecommitdiff
path: root/src/gen7_mfd.c
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-03-15 15:32:01 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-03-15 15:45:28 +0800
commita38598bfb10429f2a50e7f6f907f06cb7a5c30a7 (patch)
treed40ce10154646e043baf430d513ae276b40498eb /src/gen7_mfd.c
parent79be26ba60cd66e6377bbd8a6c580b9e8a88a4f1 (diff)
downloadlibva-intel-driver-a38598bfb10429f2a50e7f6f907f06cb7a5c30a7.tar.gz
libva-intel-driver-a38598bfb10429f2a50e7f6f907f06cb7a5c30a7.tar.bz2
libva-intel-driver-a38598bfb10429f2a50e7f6f907f06cb7a5c30a7.zip
Fix potential buffer overflow for JPEG decoding
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Diffstat (limited to 'src/gen7_mfd.c')
-rwxr-xr-xsrc/gen7_mfd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
index c081826..ed463d9 100755
--- a/src/gen7_mfd.c
+++ b/src/gen7_mfd.c
@@ -2035,14 +2035,20 @@ gen7_mfd_jpeg_qm_state(VADriverContextP ctx,
assert(pic_param->num_components <= 3);
for (index = 0; index < pic_param->num_components; index++) {
- int qm_type = va_to_gen7_jpeg_qm[pic_param->components[index].component_id - pic_param->components[0].component_id + 1];
+ int id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
+ int qm_type;
unsigned char *qm = iq_matrix->quantiser_table[pic_param->components[index].quantiser_table_selector];
unsigned char raster_qm[64];
int j;
+ if (id > 4 || id < 1)
+ continue;
+
if (!iq_matrix->load_quantiser_table[pic_param->components[index].quantiser_table_selector])
continue;
+ qm_type = va_to_gen7_jpeg_qm[id];
+
for (j = 0; j < 64; j++)
raster_qm[zigzag_direct[j]] = qm[j];