From f48c4d808ba6645c0f2f12c1a21339153206af1a Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 16 Apr 2018 16:45:34 -0600 Subject: [PATCH] add check for input size --- pem_cert/target.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pem_cert/target.c b/pem_cert/target.c index 916f372..c514fda 100644 --- a/pem_cert/target.c +++ b/pem_cert/target.c @@ -25,6 +25,8 @@ #include #include +#define WC_MAX_FUZZ_INPUT_SZ 25000 + /* testing wolfSSL_CTX_use_certificate_buffer with PEM as the filetype*/ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t sz) @@ -32,6 +34,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t sz) WOLFSSL_CTX *ctx; int ret; + /* avoid 25s timeout with parsing large files */ + if (sz > WS_MAX_FUZZ_INPUT_SZ) { + return 0; + } + wolfSSL_Init(); ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method());