File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ FUZZ_TARGETS = \
38
38
test/fuzz/partial_merkle_tree_deserialize \
39
39
test/fuzz/partially_signed_transaction_deserialize \
40
40
test/fuzz/prefilled_transaction_deserialize \
41
+ test/fuzz/parse_numbers \
41
42
test/fuzz/parse_script \
42
43
test/fuzz/psbt \
43
44
test/fuzz/psbt_input_deserialize \
@@ -532,6 +533,12 @@ test_fuzz_parse_script_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
532
533
test_fuzz_parse_script_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
533
534
test_fuzz_parse_script_LDADD = $(FUZZ_SUITE_LD_COMMON)
534
535
536
+ test_fuzz_parse_numbers_SOURCES = $(FUZZ_SUITE) test/fuzz/parse_numbers.cpp
537
+ test_fuzz_parse_numbers_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
538
+ test_fuzz_parse_numbers_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
539
+ test_fuzz_parse_numbers_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
540
+ test_fuzz_parse_numbers_LDADD = $(FUZZ_SUITE_LD_COMMON)
541
+
535
542
endif # ENABLE_FUZZ
536
543
537
544
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2009-2019 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 < test/fuzz/fuzz.h>
6
+ #include < util/moneystr.h>
7
+ #include < util/strencodings.h>
8
+
9
+ #include < string>
10
+
11
+ void test_one_input (const std::vector<uint8_t >& buffer)
12
+ {
13
+ const std::string random_string (buffer.begin (), buffer.end ());
14
+
15
+ CAmount amount;
16
+ (void )ParseMoney (random_string, amount);
17
+
18
+ double d;
19
+ (void )ParseDouble (random_string, &d);
20
+
21
+ int32_t i32 ;
22
+ (void )ParseInt32 (random_string, &i32 );
23
+ (void )atoi (random_string);
24
+
25
+ uint32_t u32 ;
26
+ (void )ParseUInt32 (random_string, &u32 );
27
+
28
+ int64_t i64 ;
29
+ (void )atoi64 (random_string);
30
+ (void )ParseFixedPoint (random_string, 3 , &i64 );
31
+ (void )ParseInt64 (random_string, &i64 );
32
+
33
+ uint64_t u64 ;
34
+ (void )ParseUInt64 (random_string, &u64 );
35
+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ KNOWN_VIOLATIONS=(
11
11
" src/qt/rpcconsole.cpp:.*atoi"
12
12
" src/rest.cpp:.*strtol"
13
13
" src/test/dbwrapper_tests.cpp:.*snprintf"
14
+ " src/test/fuzz/parse_numbers.cpp:.*atoi"
14
15
" src/torcontrol.cpp:.*atoi"
15
16
" src/torcontrol.cpp:.*strtol"
16
17
" src/util/strencodings.cpp:.*atoi"
You can’t perform that action at this time.
0 commit comments