Skip to content

Commit

Permalink
bndiv fuzzer: limit the size of the input to avoid timeout
Browse files Browse the repository at this point in the history
CLA: trivial

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from openssl/openssl#4119)
  • Loading branch information
blueknob authored and Rich Salz committed Aug 16, 2017
1 parent 64bf101 commit 61389f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fuzz/bndiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include <openssl/err.h>
#include "fuzzer.h"

/* 256 kB */
#define MAX_LEN (256 * 1000)

static BN_CTX *ctx;
static BIGNUM *b1;
static BIGNUM *b2;
Expand Down Expand Up @@ -47,6 +50,10 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
/* s1 and s2 will be the signs for b1 and b2. */
int s1 = 0, s2 = 0;

/* limit the size of the input to avoid timeout */
if (len > MAX_LEN)
len = MAX_LEN;

/* We are going to split the buffer in two, sizes l1 and l2, giving b1 and
* b2.
*/
Expand Down

0 comments on commit 61389f0

Please sign in to comment.