From a837ca19d695b4b01b019675bc99ec2aeaf564a4 Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Tue, 12 Sep 2017 13:37:44 +0200 Subject: Bug 1372101 - make exponents smaller in expmod fuzzing target, r=ttaubert Differential Revision: https://phabricator.services.mozilla.com/D53 --- fuzz/mpi_expmod_target.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'fuzz') diff --git a/fuzz/mpi_expmod_target.cc b/fuzz/mpi_expmod_target.cc index 23826e935..b9be5854f 100644 --- a/fuzz/mpi_expmod_target.cc +++ b/fuzz/mpi_expmod_target.cc @@ -19,9 +19,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { auto modulus = get_modulus(data, size, ctx); // Compare with OpenSSL exp mod m1 = &std::get<1>(modulus); - print_bn("A", A); - print_bn("B", B); - print_bn("m", std::get<0>(modulus)); + // The exponent b (B) can get really big. Make it smaller if necessary. + if (MP_USED(&b) > 100) { + size_t shift = (MP_USED(&b) - 100) * MP_DIGIT_BIT; + mp_div_2d(&b, shift, &b, nullptr); + BN_rshift(B, B, shift); + } check_equal(A, &a, max_size); check_equal(B, &b, max_size); check_equal(std::get<0>(modulus), m1, 3 * max_size); -- cgit v1.2.1 From a514bc4cc527748243d6114fc065ab35fe3a2dc0 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 27 Sep 2017 11:46:56 +0200 Subject: Bug 1403488 - Add virtual destructor to DummyPrSocket in fuzz/tls_socket.h r=franziskus Summary: See also: https://github.com/google/oss-fuzz/issues/858 Bug #: 1403488 Differential Revision: https://phabricator.services.mozilla.com/D83 --- fuzz/tls_socket.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fuzz') diff --git a/fuzz/tls_socket.h b/fuzz/tls_socket.h index 61fa4b3a8..e30f6fa3c 100644 --- a/fuzz/tls_socket.h +++ b/fuzz/tls_socket.h @@ -10,6 +10,7 @@ class DummyPrSocket : public DummyIOLayerMethods { public: DummyPrSocket(const uint8_t *buf, size_t len) : buf_(buf), len_(len) {} + virtual ~DummyPrSocket() {} int32_t Read(PRFileDesc *f, void *data, int32_t len) override; int32_t Write(PRFileDesc *f, const void *buf, int32_t length) override; -- cgit v1.2.1