Commit 1100acba authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Kostya Shishkov

vc1dec: check that coded slice positions and interlacing match.

This fixes out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarKostya Shishkov <kostya.shishkov@gmail.com>
parent 0aa907cf
...@@ -5569,6 +5569,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -5569,6 +5569,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
mb_height = s->mb_height >> v->field_mode; mb_height = s->mb_height >> v->field_mode;
for (i = 0; i <= n_slices; i++) { for (i = 0; i <= n_slices; i++) {
if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (i > 0 && slices[i - 1].mby_start >= mb_height) {
if (v->field_mode <= 0) {
av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond "
"picture boundary (%d >= %d)\n", i,
slices[i - 1].mby_start, mb_height);
continue;
}
v->second_field = 1; v->second_field = 1;
v->blocks_off = s->mb_width * s->mb_height << 1; v->blocks_off = s->mb_width * s->mb_height << 1;
v->mb_off = s->mb_stride * s->mb_height >> 1; v->mb_off = s->mb_stride * s->mb_height >> 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment