Commit 91578f57 authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 706c9bea
...@@ -70,9 +70,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -70,9 +70,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVFrame *frame = c->frame; AVFrame *frame = c->frame;
int ret; int ret;
if ((ret = ff_reget_buffer(avctx, frame)) < 0)
return ret;
ret = inflateReset(&c->zstream); ret = inflateReset(&c->zstream);
if (ret != Z_OK) { if (ret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret); 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, ...@@ -89,6 +86,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }
if ((ret = ff_reget_buffer(avctx, frame)) < 0)
return ret;
if (ret != Z_DATA_ERROR) { if (ret != Z_DATA_ERROR) {
bytestream2_init(&c->gb, c->decomp_buf, bytestream2_init(&c->gb, c->decomp_buf,
......
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