File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ FUZZ_TARGETS = \
57
57
test/fuzz/key_io \
58
58
test/fuzz/key_origin_info_deserialize \
59
59
test/fuzz/kitchen_sink \
60
+ test/fuzz/load_external_block_file \
60
61
test/fuzz/locale \
61
62
test/fuzz/merkle_block_deserialize \
62
63
test/fuzz/merkleblock \
@@ -634,6 +635,12 @@ test_fuzz_kitchen_sink_LDADD = $(FUZZ_SUITE_LD_COMMON)
634
635
test_fuzz_kitchen_sink_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
635
636
test_fuzz_kitchen_sink_SOURCES = test/fuzz/kitchen_sink.cpp
636
637
638
+ test_fuzz_load_external_block_file_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
639
+ test_fuzz_load_external_block_file_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
640
+ test_fuzz_load_external_block_file_LDADD = $(FUZZ_SUITE_LD_COMMON)
641
+ test_fuzz_load_external_block_file_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
642
+ test_fuzz_load_external_block_file_SOURCES = test/fuzz/load_external_block_file.cpp
643
+
637
644
test_fuzz_locale_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
638
645
test_fuzz_locale_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
639
646
test_fuzz_locale_LDADD = $(FUZZ_SUITE_LD_COMMON)
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2020 The Bitcoin Core developers
2
+ // Distributed under the MIT software license, see the accompanying
3
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
+
5
+ #include < chainparams.h>
6
+ #include < flatfile.h>
7
+ #include < test/fuzz/FuzzedDataProvider.h>
8
+ #include < test/fuzz/fuzz.h>
9
+ #include < test/fuzz/util.h>
10
+ #include < test/util/setup_common.h>
11
+ #include < validation.h>
12
+
13
+ #include < cstdint>
14
+ #include < vector>
15
+
16
+ void initialize ()
17
+ {
18
+ InitializeFuzzingContext ();
19
+ }
20
+
21
+ void test_one_input (const std::vector<uint8_t >& buffer)
22
+ {
23
+ FuzzedDataProvider fuzzed_data_provider{buffer.data (), buffer.size ()};
24
+ FuzzedFileProvider fuzzed_file_provider = ConsumeFile (fuzzed_data_provider);
25
+ FILE* fuzzed_block_file = fuzzed_file_provider.open ();
26
+ if (fuzzed_block_file == nullptr ) {
27
+ return ;
28
+ }
29
+ FlatFilePos flat_file_pos;
30
+ LoadExternalBlockFile (Params (), fuzzed_block_file, fuzzed_data_provider.ConsumeBool () ? &flat_file_pos : nullptr );
31
+ }
You can’t perform that action at this time.
0 commit comments