From cf95dee3de5930172900ef36e376c8a7f31988bc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 14 Dec 2013 00:58:18 +0100 Subject: [PATCH] avcodec/vc1dec: dont calculate unused values from uninitialized sprites Fixes use of uninitialized data Fixes part of msan_uninit-mem_7f51a8b0b3b0_1009_Arlington.wmv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/vc1dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 87846449ec..edddc483a2 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5364,7 +5364,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) int ysub[2]; MpegEncContext *s = &v->s; - for (i = 0; i < 2; i++) { + for (i = 0; i <= v->two_sprites; i++) { xoff[i] = av_clip(sd->coefs[i][2], 0, v->sprite_width-1 << 16); xadv[i] = sd->coefs[i][0]; if (xadv[i] != 1<<16 || (v->sprite_width << 16) - (v->output_width << 16) - xoff[i]) @@ -5442,7 +5442,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) } if (!plane) { - for (i = 0; i < 2; i++) { + for (i = 0; i <= v->two_sprites; i++) { xoff[i] >>= 1; yoff[i] >>= 1; }