diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-15 13:52:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-18 13:59:25 +0200 |
commit | 91578f5798d36467e8e2138eada5ce26c12b4e1e (patch) | |
tree | 25ab8c28cd912693dcb4e0595a76c8bbe66d83e9 | |
parent | 706c9beaead70ee861e183338e136382b17ade05 (diff) | |
download | ffmpeg-91578f5798d36467e8e2138eada5ce26c12b4e1e.tar.gz |
avcodec/tscc: Move reget buffer to after decoding
reget buffer can be time consuming, theres no need to do it if failures
occur
Testcase: 9010/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TSCC_fuzzer-6042614817095680
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/tscc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index cb86b584c1..f891932342 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -70,9 +70,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVFrame *frame = c->frame; int ret; - if ((ret = ff_reget_buffer(avctx, frame)) < 0) - return ret; - ret = inflateReset(&c->zstream); if (ret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret); @@ -89,6 +86,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_UNKNOWN; } + if ((ret = ff_reget_buffer(avctx, frame)) < 0) + return ret; if (ret != Z_DATA_ERROR) { bytestream2_init(&c->gb, c->decomp_buf, |