1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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 <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-12-14 00:58:18 +01:00
parent f5cf0ea93a
commit cf95dee3de

View File

@ -5364,7 +5364,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd)
int ysub[2]; int ysub[2];
MpegEncContext *s = &v->s; 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); xoff[i] = av_clip(sd->coefs[i][2], 0, v->sprite_width-1 << 16);
xadv[i] = sd->coefs[i][0]; xadv[i] = sd->coefs[i][0];
if (xadv[i] != 1<<16 || (v->sprite_width << 16) - (v->output_width << 16) - xoff[i]) 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) { if (!plane) {
for (i = 0; i < 2; i++) { for (i = 0; i <= v->two_sprites; i++) {
xoff[i] >>= 1; xoff[i] >>= 1;
yoff[i] >>= 1; yoff[i] >>= 1;
} }