Commit 413e0f25 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/vc1_pred: Fix refdist in scaleforopp()

Fixes: out of array access
Fixes: 16601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5656105392275456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ede15bf2
...@@ -197,9 +197,10 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, ...@@ -197,9 +197,10 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
return n; return n;
} }
if (v->s.pict_type != AV_PICTURE_TYPE_B) if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = FFMIN(v->refdist, 3); refdist = v->refdist;
else else
refdist = dir ? v->brfd : v->frfd; refdist = dir ? v->brfd : v->frfd;
refdist = FFMIN(refdist, 3);
scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist]; scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
n = (n * scaleopp >> 8) * (1 << hpel); n = (n * scaleopp >> 8) * (1 << hpel);
......
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