Commit e0952984 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/vc1dec: Check field_mode for sprites

Fixes: Out of array read
Fixes: 19263/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5389219325542400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 32fb9198)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6be091ce
...@@ -865,7 +865,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -865,7 +865,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto err; goto err;
} }
if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE)
&& v->field_mode) {
av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected Frames not Fields\n");
ret = AVERROR_INVALIDDATA;
goto err;
}
if ((s->mb_height >> v->field_mode) == 0) { if ((s->mb_height >> v->field_mode) == 0) {
av_log(v->s.avctx, AV_LOG_ERROR, "image too short\n"); av_log(v->s.avctx, AV_LOG_ERROR, "image too short\n");
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
......
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