From c42f277903028627fb916b72704fd0ccc83d4af2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 1 Aug 2021 18:31:31 +0200 Subject: [PATCH] tools/target_dec_fuzzer: check max samples in flush loop Fixes: Timeout Fixes: 36020/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-4774629855068160 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 0195d8910e..c0e59983c4 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -441,6 +441,10 @@ maximums_reached: got_frame = 0; av_frame_unref(frame); decode_handler(ctx, frame, &got_frame, avpkt); + + nb_samples += frame->nb_samples; + if (nb_samples > maxsamples) + break; } while (got_frame == 1 && it++ < maxiteration); fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64", iterations: %d\n", ec_pixels, nb_samples, it);