Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/eval_script.cpp
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <pubkey.h> | |||||
#include <script/interpreter.h> | #include <script/interpreter.h> | ||||
#include <test/fuzz/FuzzedDataProvider.h> | #include <test/fuzz/FuzzedDataProvider.h> | ||||
#include <test/fuzz/fuzz.h> | #include <test/fuzz/fuzz.h> | ||||
#include <limits> | #include <limits> | ||||
#include <memory> | |||||
void initialize() { | |||||
static const auto verify_handle = std::make_unique<ECCVerifyHandle>(); | |||||
} | |||||
void test_one_input(const std::vector<uint8_t> &buffer) { | void test_one_input(const std::vector<uint8_t> &buffer) { | ||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); | FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); | ||||
const unsigned int flags = | const unsigned int flags = | ||||
fuzzed_data_provider.ConsumeIntegral<unsigned int>(); | fuzzed_data_provider.ConsumeIntegral<unsigned int>(); | ||||
const std::vector<uint8_t> script_bytes = [&] { | const std::vector<uint8_t> script_bytes = [&] { | ||||
if (fuzzed_data_provider.remaining_bytes() != 0) { | if (fuzzed_data_provider.remaining_bytes() != 0) { | ||||
return fuzzed_data_provider.ConsumeRemainingBytes<uint8_t>(); | return fuzzed_data_provider.ConsumeRemainingBytes<uint8_t>(); | ||||
Show All 14 Lines |