aboutsummaryrefslogtreecommitdiff
path: root/fuzz/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/bignum.c')
-rw-r--r--fuzz/bignum.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fuzz/bignum.c b/fuzz/bignum.c
index d7c3716aacb4..08da6fb197f5 100644
--- a/fuzz/bignum.c
+++ b/fuzz/bignum.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,11 +52,12 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
*/
if (len > 2) {
len -= 3;
- l1 = (buf[0] * len) / 255;
+ /* limit l1, l2, and l3 to be no more than 512 bytes */
+ l1 = ((buf[0] * len) / 255) % 512;
++buf;
- l2 = (buf[0] * (len - l1)) / 255;
+ l2 = ((buf[0] * (len - l1)) / 255) % 512;
++buf;
- l3 = len - l1 - l2;
+ l3 = (len - l1 - l2) % 512;
s1 = buf[0] & 1;
s3 = buf[0] & 4;