aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/indeo5.c
diff options
context:
space:
mode:
authorLuca Barbato2013-07-12 14:33:24 +0200
committerLuca Barbato2013-07-13 19:11:18 +0200
commitdc79685195a45c9b8b17d7b93d118e0aefa45462 (patch)
tree1188ab3efacb8406d84ff847f2abede26162d0cb /libavcodec/indeo5.c
parentcd78e934c246d1b2510f8fba0abfe40bb75795f6 (diff)
indeo: Bound-check before applying transform
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/indeo5.c')
-rw-r--r--libavcodec/indeo5.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
index dc5f6f09ad..3bdb23f5f1 100644
--- a/libavcodec/indeo5.c
+++ b/libavcodec/indeo5.c
@@ -147,39 +147,47 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
/* select transform function and scan pattern according to plane and band number */
switch ((p << 2) + i) {
case 0:
- band->inv_transform = ff_ivi_inverse_slant_8x8;
- band->dc_transform = ff_ivi_dc_slant_2d;
- band->scan = ff_zigzag_direct;
+ band->inv_transform = ff_ivi_inverse_slant_8x8;
+ band->dc_transform = ff_ivi_dc_slant_2d;
+ band->scan = ff_zigzag_direct;
+ band->transform_size = 8;
break;
case 1:
- band->inv_transform = ff_ivi_row_slant8;
- band->dc_transform = ff_ivi_dc_row_slant;
- band->scan = ff_ivi_vertical_scan_8x8;
+ band->inv_transform = ff_ivi_row_slant8;
+ band->dc_transform = ff_ivi_dc_row_slant;
+ band->scan = ff_ivi_vertical_scan_8x8;
+ band->transform_size = 8;
break;
case 2:
- band->inv_transform = ff_ivi_col_slant8;
- band->dc_transform = ff_ivi_dc_col_slant;
- band->scan = ff_ivi_horizontal_scan_8x8;
+ band->inv_transform = ff_ivi_col_slant8;
+ band->dc_transform = ff_ivi_dc_col_slant;
+ band->scan = ff_ivi_horizontal_scan_8x8;
+ band->transform_size = 8;
break;
case 3:
- band->inv_transform = ff_ivi_put_pixels_8x8;
- band->dc_transform = ff_ivi_put_dc_pixel_8x8;
- band->scan = ff_ivi_horizontal_scan_8x8;
+ band->inv_transform = ff_ivi_put_pixels_8x8;
+ band->dc_transform = ff_ivi_put_dc_pixel_8x8;
+ band->scan = ff_ivi_horizontal_scan_8x8;
+ band->transform_size = 8;
break;
case 4:
- band->inv_transform = ff_ivi_inverse_slant_4x4;
- band->dc_transform = ff_ivi_dc_slant_2d;
- band->scan = ff_ivi_direct_scan_4x4;
+ band->inv_transform = ff_ivi_inverse_slant_4x4;
+ band->dc_transform = ff_ivi_dc_slant_2d;
+ band->scan = ff_ivi_direct_scan_4x4;
+ band->transform_size = 4;
break;
}
band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||
band->inv_transform == ff_ivi_inverse_slant_4x4;
+ if (band->transform_size != band->blk_size)
+ return AVERROR_INVALIDDATA;
+
/* select dequant matrix according to plane and band number */
if (!p) {
quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;