summaryrefslogtreecommitdiff
path: root/libavcodec/vc1dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-28 17:14:50 +0600
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-07-28 13:34:05 +0200
commit1100acbab26883007898c53efeb289f562c6e514 (patch)
tree249a7d151bb600b7cc0ddc957b9e2c0743a46a9d /libavcodec/vc1dec.c
parent0aa907cfb1bbc647ee4b6da62fac5c89d7b4d318 (diff)
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: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r--libavcodec/vc1dec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index f49fff8b98..5726c0adbc 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5569,6 +5569,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
mb_height = s->mb_height >> v->field_mode;
for (i = 0; i <= n_slices; i++) {
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->blocks_off = s->mb_width * s->mb_height << 1;
v->mb_off = s->mb_stride * s->mb_height >> 1;