mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
fuzz: AutoFile with XOR
This commit is contained in:
parent
fab5cb9066
commit
faa25718b3
@ -2,16 +2,16 @@
|
|||||||
// 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 <span.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
FUZZ_TARGET(autofile)
|
FUZZ_TARGET(autofile)
|
||||||
@ -20,6 +20,7 @@ FUZZ_TARGET(autofile)
|
|||||||
FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider};
|
FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider};
|
||||||
AutoFile auto_file{
|
AutoFile auto_file{
|
||||||
fuzzed_file_provider.open(),
|
fuzzed_file_provider.open(),
|
||||||
|
ConsumeRandomLengthByteVector<std::byte>(fuzzed_data_provider),
|
||||||
};
|
};
|
||||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100)
|
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100)
|
||||||
{
|
{
|
||||||
|
@ -2,16 +2,17 @@
|
|||||||
// 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 <span.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
FUZZ_TARGET(buffered_file)
|
FUZZ_TARGET(buffered_file)
|
||||||
@ -19,7 +20,11 @@ FUZZ_TARGET(buffered_file)
|
|||||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||||
FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider};
|
FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider};
|
||||||
std::optional<BufferedFile> opt_buffered_file;
|
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 {
|
try {
|
||||||
opt_buffered_file.emplace(fuzzed_file, fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096), fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096));
|
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&) {
|
} catch (const std::ios_base::failure&) {
|
||||||
|
Loading…
Reference in New Issue
Block a user