aboutsummaryrefslogtreecommitdiffstats
path: root/src/extra_tests/fuzzers/jigs/bn_sqr.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-14 14:15:42 -0500
committerJack Lloyd <[email protected]>2016-12-14 14:15:42 -0500
commit08482b59872fe590fbd73981733beebc1e72f51f (patch)
tree30b07adcced47236a1de9d7d15713d4dd0c27917 /src/extra_tests/fuzzers/jigs/bn_sqr.cpp
parentf6bf79ef827aa28c285dd0e2444ca602fbb8a87b (diff)
Update fuzzers with comments from OSS-Fuzz review
Add explicit length limitations, to prevent the fuzzer from just giving us increasingly long inputs until timeout occurs due to non-linear algorithms. Use LLVM fuzzer interface in all cases, and just have AFL driver call that API when a define is set to include a main function. OSS-Fuzz will be using the LLVM API, regardless of the fuzzing engine. [ci skip]
Diffstat (limited to 'src/extra_tests/fuzzers/jigs/bn_sqr.cpp')
-rw-r--r--src/extra_tests/fuzzers/jigs/bn_sqr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/extra_tests/fuzzers/jigs/bn_sqr.cpp b/src/extra_tests/fuzzers/jigs/bn_sqr.cpp
index 2bc5ebe33..aa76067f7 100644
--- a/src/extra_tests/fuzzers/jigs/bn_sqr.cpp
+++ b/src/extra_tests/fuzzers/jigs/bn_sqr.cpp
@@ -11,6 +11,9 @@
void fuzz(const uint8_t in[], size_t len)
{
+ if(len > 8192/8)
+ return;
+
Botan::BigInt x = Botan::BigInt::decode(in, len);
Botan::BigInt x_sqr = square(x);