forked from FFmpeg/FFmpeg
avcodec/agm: Check for reference frame earlier
Fixes: Timeout (14sec - 120ms) Fixes: 17824/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5639825457152000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
a6ad328256
commit
315a445933
1 changed files with 7 additions and 4 deletions
|
@ -1117,6 +1117,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||||
frame->key_frame = s->key_frame;
|
frame->key_frame = s->key_frame;
|
||||||
frame->pict_type = s->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
frame->pict_type = s->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||||
|
|
||||||
|
if (!s->key_frame) {
|
||||||
|
if (!s->prev_frame->data[0]) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (header) {
|
if (header) {
|
||||||
if (avctx->codec_tag == MKTAG('A', 'G', 'M', '0') ||
|
if (avctx->codec_tag == MKTAG('A', 'G', 'M', '0') ||
|
||||||
avctx->codec_tag == MKTAG('A', 'G', 'M', '1'))
|
avctx->codec_tag == MKTAG('A', 'G', 'M', '1'))
|
||||||
|
@ -1186,10 +1193,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||||
else
|
else
|
||||||
ret = decode_intra(avctx, gb, frame);
|
ret = decode_intra(avctx, gb, frame);
|
||||||
} else {
|
} else {
|
||||||
if (!s->prev_frame->data[0]) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
|
||||||
if (s->prev_frame-> width != frame->width ||
|
if (s->prev_frame-> width != frame->width ||
|
||||||
s->prev_frame->height != frame->height)
|
s->prev_frame->height != frame->height)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
Loading…
Add table
Reference in a new issue