From f03d6345d4808bbbb41b7ae10e3513557bb6193a Mon Sep 17 00:00:00 2001 From: Catena cyber <35799796+catenacyber@users.noreply.github.com> Date: Tue, 29 Oct 2019 14:58:12 +0100 Subject: [PATCH] Limits input size for gnupg list fuzz target (#2987) --- projects/gnupg/fuzz_list.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/gnupg/fuzz_list.c b/projects/gnupg/fuzz_list.c index 07fc1db94..8e1e0034b 100644 --- a/projects/gnupg/fuzz_list.c +++ b/projects/gnupg/fuzz_list.c @@ -71,6 +71,9 @@ static void rmrfdir(char *path) } } +// 65kb should be enough ;-) +#define MAX_LEN 0x10000 + int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { IOBUF a; armor_filter_context_t *afx = NULL; @@ -132,6 +135,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { initialized = true; } + if (Size > MAX_LEN) { + // limit maximum size to avoid long computing times + Size = MAX_LEN; + } + memset(ctrlGlobal, 0, sizeof(*ctrlGlobal)); ctrlGlobal->magic = SERVER_CONTROL_MAGIC;