File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ FUZZ_TARGETS = \
2828 test/fuzz/eval_script \
2929 test/fuzz/fee_rate_deserialize \
3030 test/fuzz/flat_file_pos_deserialize \
31+ test/fuzz/hex \
3132 test/fuzz/integer \
3233 test/fuzz/inv_deserialize \
3334 test/fuzz/key_origin_info_deserialize \
@@ -363,6 +364,12 @@ test_fuzz_address_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
363364test_fuzz_address_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
364365test_fuzz_address_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
365366
367+ test_fuzz_hex_SOURCES = $(FUZZ_SUITE) test/fuzz/hex.cpp
368+ test_fuzz_hex_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
369+ test_fuzz_hex_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
370+ test_fuzz_hex_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
371+ test_fuzz_hex_LDADD = $(FUZZ_SUITE_LD_COMMON)
372+
366373test_fuzz_inv_deserialize_SOURCES = $(FUZZ_SUITE) test/fuzz/deserialize.cpp
367374test_fuzz_inv_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DINV_DESERIALIZE=1
368375test_fuzz_inv_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
Original file line number Diff line number Diff line change 1+ // Copyright (c) 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+
7+ #include < util/strencodings.h>
8+
9+ #include < cassert>
10+ #include < cstdint>
11+ #include < string>
12+ #include < vector>
13+
14+ void test_one_input (const std::vector<uint8_t >& buffer)
15+ {
16+ const std::string random_hex_string (buffer.begin (), buffer.end ());
17+ const std::vector<unsigned char > data = ParseHex (random_hex_string);
18+ const std::string hex_data = HexStr (data);
19+ if (IsHex (random_hex_string)) {
20+ assert (ToLower (random_hex_string) == hex_data);
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments