diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/autofile.cpp | 7 | ||||
-rw-r--r-- | src/test/fuzz/buffered_file.cpp | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/test/fuzz/autofile.cpp b/src/test/fuzz/autofile.cpp index bf7119b761..45316b6b21 100644 --- a/src/test/fuzz/autofile.cpp +++ b/src/test/fuzz/autofile.cpp @@ -2,16 +2,16 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <span.h> #include <streams.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> #include <test/fuzz/util.h> #include <array> -#include <cstdint> +#include <cstddef> +#include <cstdio> #include <iostream> -#include <optional> -#include <string> #include <vector> FUZZ_TARGET(autofile) @@ -20,6 +20,7 @@ FUZZ_TARGET(autofile) FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider}; AutoFile auto_file{ fuzzed_file_provider.open(), + ConsumeRandomLengthByteVector<std::byte>(fuzzed_data_provider), }; LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) { diff --git a/src/test/fuzz/buffered_file.cpp b/src/test/fuzz/buffered_file.cpp index e345aa301c..813af63738 100644 --- a/src/test/fuzz/buffered_file.cpp +++ b/src/test/fuzz/buffered_file.cpp @@ -2,16 +2,17 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <span.h> #include <streams.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> #include <test/fuzz/util.h> #include <array> +#include <cstddef> #include <cstdint> #include <iostream> #include <optional> -#include <string> #include <vector> FUZZ_TARGET(buffered_file) @@ -19,7 +20,11 @@ FUZZ_TARGET(buffered_file) FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider}; std::optional<BufferedFile> opt_buffered_file; - CAutoFile fuzzed_file{fuzzed_file_provider.open(), 0}; + CAutoFile fuzzed_file{ + fuzzed_file_provider.open(), + 0, + ConsumeRandomLengthByteVector<std::byte>(fuzzed_data_provider), + }; try { opt_buffered_file.emplace(fuzzed_file, fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096), fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096)); } catch (const std::ios_base::failure&) { |