diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-03-24 22:04:12 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-01 00:23:52 +0300 |
commit | 468ae6a734b2db5fcfc9596770516d76ca8b2818 (patch) | |
tree | 62410543bf8e7c5c5771c1fdf8a527b792594e00 /libavcodec/proresdec2.c | |
parent | 4f5e660e69545bd54955002c13dcbe4dbddb1dc4 (diff) |
avcodec/proresdec2: decode picture header before frame allocation
Fixes: Timeout (21sec -> 0.3sec)
Fixes: 13716/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_fuzzer-5755593333145600
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/proresdec2.c')
-rw-r--r-- | libavcodec/proresdec2.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 6209c229c9..2652a31c81 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -778,9 +778,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += frame_hdr_size; buf_size -= frame_hdr_size; - if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0) - return ret; - decode_picture: pic_size = decode_picture_header(avctx, buf, buf_size); if (pic_size < 0) { @@ -788,6 +785,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return pic_size; } + if (ctx->first_field) + if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0) + return ret; + if ((ret = decode_picture(avctx)) < 0) { av_log(avctx, AV_LOG_ERROR, "error decoding picture\n"); return ret; |