aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-10 14:38:32 -0500
committerJack Lloyd <[email protected]>2016-12-10 15:30:09 -0500
commitcd3e4151ff911b85449b3b50c90866da66b219a2 (patch)
tree72b4ce649b45af27ab43bf12153297ec8a48b18f /src
parentf19807f35f26e8c7c7cda5893306cd2c3ef41b91 (diff)
Ignore too-large inputs in ressol fuzzer
OSS-Fuzz just gave us a gigantic input and then timed out. In practice ressol is only called with specific primes of various common ECC parameter sets, so limit to 768 bits max. [ci skip]
Diffstat (limited to 'src')
-rw-r--r--src/extra_tests/fuzzers/jigs/ressol.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/extra_tests/fuzzers/jigs/ressol.cpp b/src/extra_tests/fuzzers/jigs/ressol.cpp
index 4c3f8df69..3f7f82502 100644
--- a/src/extra_tests/fuzzers/jigs/ressol.cpp
+++ b/src/extra_tests/fuzzers/jigs/ressol.cpp
@@ -9,7 +9,12 @@
void fuzz(const uint8_t in[], size_t len)
{
- if(len % 2 != 0)
+ /*
+ * This allows two values (a,p) up to 768 bits in length, which is
+ * sufficient to test ressol (modular square root) for since it is
+ * mostly used for ECC.
+ */
+ if(len % 2 != 0 || len > 2 * (768 / 8))
return;
const BigInt a = BigInt::decode(in, len / 2);