diff options
author | Felicia Lim <flim@google.com> | 2020-08-10 09:49:48 -0700 |
---|---|---|
committer | Felicia Lim <flim@google.com> | 2020-08-10 09:50:20 -0700 |
commit | 6bae366f9fef25191fc812c430e8abd40a13a233 (patch) | |
tree | e3f925a7a0c098319139ee2d9ddffe1e55b8bf35 | |
parent | b83dd52868326a401c8578041e3dbea439d53f11 (diff) | |
download | opus-6bae366f9fef25191fc812c430e8abd40a13a233.tar.gz |
opus_decoder_fuzzer: limit the number of decodes to avoid timeout
-rw-r--r-- | tests/opus_decode_fuzzer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/opus_decode_fuzzer.c b/tests/opus_decode_fuzzer.c index 20fa1e5a..ea6ec4fd 100644 --- a/tests/opus_decode_fuzzer.c +++ b/tests/opus_decode_fuzzer.c @@ -40,6 +40,8 @@ /* 4 bytes: packet length, 4 bytes: encoder final range */ #define SETUP_BYTE_COUNT 8 +#define MAX_DECODES 12 + typedef struct { int fs; int channels; @@ -66,6 +68,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { TocInfo toc; int i = 0; int err = OPUS_OK; + int num_decodes = 0; /* Not enough data to setup the decoder (+1 for the ToC) */ if (size < SETUP_BYTE_COUNT + 1) { @@ -82,7 +85,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { pcm = (opus_int16*) malloc(sizeof(*pcm) * MAX_FRAME_SAMP * toc.channels); - while (i + SETUP_BYTE_COUNT < size) { + while (i + SETUP_BYTE_COUNT < size && num_decodes++ < MAX_DECODES) { int len, fec; len = (opus_uint32) data[i ] << 24 | |