diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp index 9364ac4a32..3a74143dc2 100644 --- a/src/test/fuzz/deserialize.cpp +++ b/src/test/fuzz/deserialize.cpp @@ -23,7 +23,7 @@ #include -void test_one_input(std::vector buffer) +void test_one_input(const std::vector& buffer) { CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); try { diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 0709da5563..cfa160dde2 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -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(data, data + size)); + const std::vector input(data, data + size); + test_one_input(input); return 0; } diff --git a/src/test/fuzz/fuzz.h b/src/test/fuzz/fuzz.h index 4e009d9b54..573bd572db 100644 --- a/src/test/fuzz/fuzz.h +++ b/src/test/fuzz/fuzz.h @@ -9,6 +9,6 @@ #include -void test_one_input(std::vector buffer); +void test_one_input(const std::vector& buffer); #endif // BITCOIN_TEST_FUZZ_FUZZ_H diff --git a/src/test/fuzz/script_flags.cpp b/src/test/fuzz/script_flags.cpp index 9b90d66755..0bf5cd5c72 100644 --- a/src/test/fuzz/script_flags.cpp +++ b/src/test/fuzz/script_flags.cpp @@ -11,7 +11,7 @@ /** Flags that are not forbidden by an assert */ static bool IsValidFlagCombination(unsigned flags); -void test_one_input(std::vector buffer) +void test_one_input(const std::vector& buffer) { CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); try {