ivi_common: check that scan pattern is set before using it.

Fixes CVE-2012-2791.

CC: libav-stable@libav.org
This commit is contained in:
Anton Khirnov 2012-12-13 19:38:20 +01:00
parent 07acdd651d
commit deabb52ab4
1 changed files with 5 additions and 0 deletions

View File

@ -460,6 +460,11 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile
} }
if (cbp & 1) { /* block coded ? */ if (cbp & 1) { /* block coded ? */
if (!band->scan) {
av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n");
return AVERROR_INVALIDDATA;
}
scan_pos = -1; scan_pos = -1;
memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */ memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */
memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */ memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */