tests: Pass fuzzing inputs as constant references

pull/764/head
practicalswift 5 years ago
parent 7b701fef58
commit ffa2221256

@ -23,7 +23,7 @@
#include <test/fuzz/fuzz.h>
void test_one_input(std::vector<uint8_t> buffer)
void test_one_input(const std::vector<uint8_t>& buffer)
{
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);
try {

@ -30,7 +30,8 @@ static void initialize()
// This function is used by libFuzzer
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
test_one_input(std::vector<uint8_t>(data, data + size));
const std::vector<uint8_t> input(data, data + size);
test_one_input(input);
return 0;
}

@ -9,6 +9,6 @@
#include <vector>
void test_one_input(std::vector<uint8_t> buffer);
void test_one_input(const std::vector<uint8_t>& buffer);
#endif // BITCOIN_TEST_FUZZ_FUZZ_H

@ -11,7 +11,7 @@
/** Flags that are not forbidden by an assert */
static bool IsValidFlagCombination(unsigned flags);
void test_one_input(std::vector<uint8_t> buffer)
void test_one_input(const std::vector<uint8_t>& buffer)
{
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);
try {

Loading…
Cancel
Save