tools/target_dec_fuzzer: move maximum variables into function

This fixes an issue when multiple cases are fuzzed in a single run and
the limits are adjusted by more than the iteration limit. In that case
the adjusted limit leaked back into the global limit causing the
fuzzer to become ineffective after several iterations, MSS2 was
affected by this for example.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-07-06 17:43:08 +02:00
parent 343d950a4a
commit 29c95765e8

View File

@ -98,15 +98,15 @@ static int audio_video_handler(AVCodecContext *avctx, AVFrame *frame,
// Ensure we don't loop forever
const uint32_t maxiteration = 8096;
uint64_t maxpixels_per_frame = 4096 * 4096;
uint64_t maxpixels;
uint64_t maxsamples_per_frame = 256*1024*32;
uint64_t maxsamples;
static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
uint64_t maxpixels_per_frame = 4096 * 4096;
uint64_t maxpixels;
uint64_t maxsamples_per_frame = 256*1024*32;
uint64_t maxsamples;
const uint64_t fuzz_tag = FUZZ_TAG;
const uint8_t *last = data;
const uint8_t *end = data + size;