diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-21 15:34:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-25 14:30:04 +0200 |
commit | 4dc3714c48e74e75a3a9c7d9fb52fd5917107508 (patch) | |
tree | ae40a7f58cb6dc89bb757457e35986b762210a28 | |
parent | ea71a48c7e8a76ee447fa518cca087df9288288d (diff) | |
download | ffmpeg-4dc3714c48e74e75a3a9c7d9fb52fd5917107508.tar.gz |
avcodec/tscc2: Skip duplicate frames
This turns CFR duplicated frames into skiped frames
Fixes: Timeout
Fixes: 1719/clusterfuzz-testcase-minimized-6375090079924224
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/tscc2.c | 13 | ||||
-rw-r--r-- | tests/ref/fate/tscc2-avi | 8 |
2 files changed, 5 insertions, 16 deletions
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index f64c76507e..a8c7ee7996 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -235,18 +235,15 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { - return ret; - } - if (frame_type == 0) { - *got_frame = 1; - if ((ret = av_frame_ref(data, c->pic)) < 0) - return ret; - + // Skip duplicate frames return buf_size; } + if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { + return ret; + } + if (bytestream2_get_bytes_left(&gb) < 4) { av_log(avctx, AV_LOG_ERROR, "Frame is too short\n"); return AVERROR_INVALIDDATA; diff --git a/tests/ref/fate/tscc2-avi b/tests/ref/fate/tscc2-avi index 6f0e8a53d3..09ed897337 100644 --- a/tests/ref/fate/tscc2-avi +++ b/tests/ref/fate/tscc2-avi @@ -5,33 +5,25 @@ #sar 0: 0/1 0, 0, 0, 1, 230400, 0x7a2103c0 0, 1, 1, 1, 230400, 0xd381c279 -0, 2, 2, 1, 230400, 0xd381c279 0, 3, 3, 1, 230400, 0x110aec27 0, 4, 4, 1, 230400, 0x4be67ee7 0, 5, 5, 1, 230400, 0xd87fe4b4 -0, 6, 6, 1, 230400, 0xd87fe4b4 0, 7, 7, 1, 230400, 0x9bc6a398 0, 8, 8, 1, 230400, 0xd67d92db 0, 9, 9, 1, 230400, 0x3df6559e -0, 10, 10, 1, 230400, 0x3df6559e 0, 11, 11, 1, 230400, 0x2136ff25 0, 12, 12, 1, 230400, 0x94573fe6 0, 13, 13, 1, 230400, 0xbf67d3f5 -0, 14, 14, 1, 230400, 0xbf67d3f5 0, 15, 15, 1, 230400, 0x2592b5cf 0, 16, 16, 1, 230400, 0x5b23cd93 0, 17, 17, 1, 230400, 0x9b76d079 -0, 18, 18, 1, 230400, 0x9b76d079 0, 19, 19, 1, 230400, 0x771a017e 0, 20, 20, 1, 230400, 0xacfee1d0 0, 21, 21, 1, 230400, 0x6b9ff4eb -0, 22, 22, 1, 230400, 0x6b9ff4eb 0, 23, 23, 1, 230400, 0xbaf643e1 0, 24, 24, 1, 230400, 0x052efe59 0, 25, 25, 1, 230400, 0xd751f901 -0, 26, 26, 1, 230400, 0xd751f901 0, 27, 27, 1, 230400, 0x6f94e11f 0, 28, 28, 1, 230400, 0x17eeabb9 0, 29, 29, 1, 230400, 0x3733a035 -0, 30, 30, 1, 230400, 0x3733a035 0, 31, 31, 1, 230400, 0xb0829f45 |