aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-31 22:12:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commit9f95fb5402bfa65793c1b53ba9d764e9ab0d91c7 (patch)
treee6571037e436a0961753ec03a67c009f43e39855
parent3030fe2ccdfc251c649a46a23e46363d1b627422 (diff)
downloadffmpeg-9f95fb5402bfa65793c1b53ba9d764e9ab0d91c7.tar.gz
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 413e0f2516eef678011cffd1ec6f0d92aa8bb96a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vc1_pred.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index aa8e402af9..a126677c72 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -197,9 +197,10 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
return n;
}
if (v->s.pict_type != AV_PICTURE_TYPE_B)
- refdist = FFMIN(v->refdist, 3);
+ refdist = v->refdist;
else
refdist = dir ? v->brfd : v->frfd;
+ refdist = FFMIN(refdist, 3);
scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
n = (n * scaleopp >> 8) * (1 << hpel);