/root/bitcoin/src/test/fuzz/util.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2009-2022 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 | | #ifndef BITCOIN_TEST_FUZZ_UTIL_H |
6 | | #define BITCOIN_TEST_FUZZ_UTIL_H |
7 | | |
8 | | #include <addresstype.h> |
9 | | #include <arith_uint256.h> |
10 | | #include <coins.h> |
11 | | #include <compat/compat.h> |
12 | | #include <consensus/amount.h> |
13 | | #include <consensus/consensus.h> |
14 | | #include <key.h> |
15 | | #include <merkleblock.h> |
16 | | #include <primitives/transaction.h> |
17 | | #include <script/script.h> |
18 | | #include <serialize.h> |
19 | | #include <streams.h> |
20 | | #include <test/fuzz/FuzzedDataProvider.h> |
21 | | #include <test/fuzz/fuzz.h> |
22 | | #include <uint256.h> |
23 | | |
24 | | #include <algorithm> |
25 | | #include <array> |
26 | | #include <cstdint> |
27 | | #include <cstdio> |
28 | | #include <optional> |
29 | | #include <string> |
30 | | #include <vector> |
31 | | |
32 | | class PeerManager; |
33 | | |
34 | | template <typename... Callables> |
35 | | size_t CallOneOf(FuzzedDataProvider& fuzzed_data_provider, Callables... callables) |
36 | 23.6k | { |
37 | 23.6k | constexpr size_t call_size{sizeof...(callables)}; |
38 | 23.6k | static_assert(call_size >= 1); |
39 | 23.6k | const size_t call_index{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, call_size - 1)}; |
40 | | |
41 | 23.6k | size_t i{0}; |
42 | 71.0k | ((i++ == call_index ? callables() : void()), ...); |
43 | 23.6k | return call_size; |
44 | 23.6k | } Unexecuted instantiation: addrman.cpp:_Z9CallOneOfIJZ19addrman_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z19addrman_fuzz_targetS2_E3$_1Z19addrman_fuzz_targetS2_E3$_2Z19addrman_fuzz_targetS2_E3$_3Z19addrman_fuzz_targetS2_E3$_4Z19addrman_fuzz_targetS2_E3$_5Z19addrman_fuzz_targetS2_E3$_6EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: autofile.cpp:_Z9CallOneOfIJZ20autofile_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z20autofile_fuzz_targetS2_E3$_1Z20autofile_fuzz_targetS2_E3$_2Z20autofile_fuzz_targetS2_E3$_3Z20autofile_fuzz_targetS2_E3$_4Z20autofile_fuzz_targetS2_E3$_5EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: _Z9CallOneOfIJZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_EUlvE_ZS0_IS1_EvS3_S5_EUlvE0_ZS0_IS1_EvS3_S5_EUlvE1_ZS0_IS1_EvS3_S5_EUlvE2_ZS0_IS1_EvS3_S5_EUlvE3_ZS0_IS1_EvS3_S5_EUlvE4_ZS0_IS1_EvS3_S5_EUlvE5_ZS0_IS1_EvS3_S5_EUlvE6_ZS0_IS1_EvS3_S5_EUlvE7_ZS0_IS1_EvS3_S5_EUlvE8_ZS0_IS1_EvS3_S5_EUlvE9_EEmS3_DpT_ Unexecuted instantiation: _Z9CallOneOfIJZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_EUlvE_ZS0_IS1_EvS3_S5_EUlvE0_ZS0_IS1_EvS3_S5_EUlvE1_ZS0_IS1_EvS3_S5_EUlvE2_ZS0_IS1_EvS3_S5_EUlvE3_ZS0_IS1_EvS3_S5_EUlvE4_ZS0_IS1_EvS3_S5_EUlvE5_ZS0_IS1_EvS3_S5_EUlvE6_ZS0_IS1_EvS3_S5_EUlvE7_ZS0_IS1_EvS3_S5_EUlvE8_ZS0_IS1_EvS3_S5_EUlvE9_EEmS3_DpT_ Unexecuted instantiation: banman.cpp:_Z9CallOneOfIJZ18banman_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z18banman_fuzz_targetS2_E3$_1Z18banman_fuzz_targetS2_E3$_2Z18banman_fuzz_targetS2_E3$_3Z18banman_fuzz_targetS2_E3$_4Z18banman_fuzz_targetS2_E3$_5Z18banman_fuzz_targetS2_E3$_6Z18banman_fuzz_targetS2_E3$_7Z18banman_fuzz_targetS2_E3$_8Z18banman_fuzz_targetS2_E3$_9EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: bitdeque.cpp:_Z9CallOneOfIJZ20bitdeque_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z20bitdeque_fuzz_targetS2_E3$_1Z20bitdeque_fuzz_targetS2_E3$_2Z20bitdeque_fuzz_targetS2_E3$_3Z20bitdeque_fuzz_targetS2_E3$_4Z20bitdeque_fuzz_targetS2_E3$_5Z20bitdeque_fuzz_targetS2_E3$_6Z20bitdeque_fuzz_targetS2_E3$_7Z20bitdeque_fuzz_targetS2_E3$_8Z20bitdeque_fuzz_targetS2_E3$_9Z20bitdeque_fuzz_targetS2_E4$_10Z20bitdeque_fuzz_targetS2_E4$_11Z20bitdeque_fuzz_targetS2_E4$_12Z20bitdeque_fuzz_targetS2_E4$_13Z20bitdeque_fuzz_targetS2_E4$_14Z20bitdeque_fuzz_targetS2_E4$_15Z20bitdeque_fuzz_targetS2_E4$_16Z20bitdeque_fuzz_targetS2_E4$_17Z20bitdeque_fuzz_targetS2_E4$_18Z20bitdeque_fuzz_targetS2_E4$_19Z20bitdeque_fuzz_targetS2_E4$_20Z20bitdeque_fuzz_targetS2_E4$_21Z20bitdeque_fuzz_targetS2_E4$_22Z20bitdeque_fuzz_targetS2_E4$_23Z20bitdeque_fuzz_targetS2_E4$_24Z20bitdeque_fuzz_targetS2_E4$_25Z20bitdeque_fuzz_targetS2_E4$_26Z20bitdeque_fuzz_targetS2_E4$_27Z20bitdeque_fuzz_targetS2_E4$_28Z20bitdeque_fuzz_targetS2_E4$_29Z20bitdeque_fuzz_targetS2_E4$_30Z20bitdeque_fuzz_targetS2_E4$_31Z20bitdeque_fuzz_targetS2_E4$_32Z20bitdeque_fuzz_targetS2_E4$_33Z20bitdeque_fuzz_targetS2_E4$_34Z20bitdeque_fuzz_targetS2_E4$_35Z20bitdeque_fuzz_targetS2_E4$_36Z20bitdeque_fuzz_targetS2_E4$_37Z20bitdeque_fuzz_targetS2_E4$_38Z20bitdeque_fuzz_targetS2_E4$_39Z20bitdeque_fuzz_targetS2_E4$_40Z20bitdeque_fuzz_targetS2_E4$_41Z20bitdeque_fuzz_targetS2_E4$_42Z20bitdeque_fuzz_targetS2_E4$_43Z20bitdeque_fuzz_targetS2_E4$_44Z20bitdeque_fuzz_targetS2_E4$_45EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: bloom_filter.cpp:_Z9CallOneOfIJZ24bloom_filter_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z24bloom_filter_fuzz_targetS2_E3$_1Z24bloom_filter_fuzz_targetS2_E3$_2Z24bloom_filter_fuzz_targetS2_E3$_3EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: buffered_file.cpp:_Z9CallOneOfIJZ25buffered_file_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z25buffered_file_fuzz_targetS2_E3$_1Z25buffered_file_fuzz_targetS2_E3$_2Z25buffered_file_fuzz_targetS2_E3$_3Z25buffered_file_fuzz_targetS2_E3$_4EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: _Z9CallOneOfIJZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_EUlvE_ZS0_IS1_EvS3_S5_EUlvE0_ZS0_IS1_EvS3_S5_EUlvE1_ZS0_IS1_EvS3_S5_EUlvE2_ZS0_IS1_EvS3_S5_EUlvE3_ZS0_IS1_EvS3_S5_EUlvE4_ZS0_IS1_EvS3_S5_EUlvE5_ZS0_IS1_EvS3_S5_EUlvE6_ZS0_IS1_EvS3_S5_EUlvE7_ZS0_IS1_EvS3_S5_EUlvE8_ZS0_IS1_EvS3_S5_EUlvE9_EEmS3_DpT_ Unexecuted instantiation: coins_view.cpp:_Z9CallOneOfIJZ22coins_view_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z22coins_view_fuzz_targetS2_E3$_1Z22coins_view_fuzz_targetS2_E3$_2Z22coins_view_fuzz_targetS2_E3$_3Z22coins_view_fuzz_targetS2_E3$_4Z22coins_view_fuzz_targetS2_E3$_5Z22coins_view_fuzz_targetS2_E3$_6Z22coins_view_fuzz_targetS2_E3$_7Z22coins_view_fuzz_targetS2_E3$_8Z22coins_view_fuzz_targetS2_E3$_9Z22coins_view_fuzz_targetS2_E4$_10EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: coins_view.cpp:_Z9CallOneOfIJZ22coins_view_fuzz_targetSt4spanIKhLm18446744073709551615EEE4$_11Z22coins_view_fuzz_targetS2_E4$_12Z22coins_view_fuzz_targetS2_E4$_13Z22coins_view_fuzz_targetS2_E4$_14Z22coins_view_fuzz_targetS2_E4$_15Z22coins_view_fuzz_targetS2_E4$_16EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: coinscache_sim.cpp:_Z9CallOneOfIJZ26coinscache_sim_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_2Z26coinscache_sim_fuzz_targetS2_E3$_3Z26coinscache_sim_fuzz_targetS2_E3$_4Z26coinscache_sim_fuzz_targetS2_E3$_5Z26coinscache_sim_fuzz_targetS2_E3$_6Z26coinscache_sim_fuzz_targetS2_E3$_7Z26coinscache_sim_fuzz_targetS2_E3$_8Z26coinscache_sim_fuzz_targetS2_E3$_9Z26coinscache_sim_fuzz_targetS2_E4$_10Z26coinscache_sim_fuzz_targetS2_E4$_11Z26coinscache_sim_fuzz_targetS2_E4$_12Z26coinscache_sim_fuzz_targetS2_E4$_13Z26coinscache_sim_fuzz_targetS2_E4$_14Z26coinscache_sim_fuzz_targetS2_E4$_15Z26coinscache_sim_fuzz_targetS2_E4$_16Z26coinscache_sim_fuzz_targetS2_E4$_17Z26coinscache_sim_fuzz_targetS2_E4$_18EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: connman.cpp:_Z9CallOneOfIJZ19connman_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_2Z19connman_fuzz_targetS2_E3$_3Z19connman_fuzz_targetS2_E3$_4Z19connman_fuzz_targetS2_E3$_5Z19connman_fuzz_targetS2_E3$_6Z19connman_fuzz_targetS2_E3$_7Z19connman_fuzz_targetS2_E3$_8Z19connman_fuzz_targetS2_E3$_9Z19connman_fuzz_targetS2_E4$_10Z19connman_fuzz_targetS2_E3$_0Z19connman_fuzz_targetS2_E3$_1Z19connman_fuzz_targetS2_E4$_11Z19connman_fuzz_targetS2_E4$_12Z19connman_fuzz_targetS2_E4$_13Z19connman_fuzz_targetS2_E4$_14Z19connman_fuzz_targetS2_E4$_15Z19connman_fuzz_targetS2_E4$_16Z19connman_fuzz_targetS2_E4$_17Z19connman_fuzz_targetS2_E4$_18Z19connman_fuzz_targetS2_E4$_19EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: crypto.cpp:_Z9CallOneOfIJZ18crypto_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z18crypto_fuzz_targetS2_E3$_1Z18crypto_fuzz_targetS2_E3$_2EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: crypto.cpp:_Z9CallOneOfIJZZ18crypto_fuzz_targetSt4spanIKhLm18446744073709551615EEENK3$_2clEvEUlvE_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE0_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE1_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE2_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE3_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE4_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE5_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE6_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE7_ZZ18crypto_fuzz_targetS2_ENKS3_clEvEUlvE8_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: crypto_chacha20.cpp:_Z9CallOneOfIJZ27crypto_chacha20_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z27crypto_chacha20_fuzz_targetS2_E3$_1Z27crypto_chacha20_fuzz_targetS2_E3$_2Z27crypto_chacha20_fuzz_targetS2_E3$_3EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: crypto_diff_fuzz_chacha20.cpp:_Z9CallOneOfIJZ37crypto_diff_fuzz_chacha20_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z37crypto_diff_fuzz_chacha20_fuzz_targetS2_E3$_1Z37crypto_diff_fuzz_chacha20_fuzz_targetS2_E3$_2Z37crypto_diff_fuzz_chacha20_fuzz_targetS2_E3$_3EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: float.cpp:_Z9CallOneOfIJZZ17float_fuzz_targetSt4spanIKhLm18446744073709551615EEENK3$_0clEvEUlvE_ZZ17float_fuzz_targetS2_ENKS3_clEvEUlvE0_ZZ17float_fuzz_targetS2_ENKS3_clEvEUlvE1_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: merkleblock.cpp:_Z9CallOneOfIJZ23merkleblock_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z23merkleblock_fuzz_targetS2_E3$_1EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: minisketch.cpp:_Z9CallOneOfIJZ22minisketch_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_2Z22minisketch_fuzz_targetS2_E3$_3Z22minisketch_fuzz_targetS2_E3$_4EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: muhash.cpp:_Z9CallOneOfIJZ18muhash_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z18muhash_fuzz_targetS2_E3$_1Z18muhash_fuzz_targetS2_E3$_2Z18muhash_fuzz_targetS2_E3$_3EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: net.cpp:_Z9CallOneOfIJZ15net_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z15net_fuzz_targetS2_E3$_1Z15net_fuzz_targetS2_E3$_2Z15net_fuzz_targetS2_E3$_3Z15net_fuzz_targetS2_E3$_4EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: net.cpp:_Z9CallOneOfIJZ25local_address_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z25local_address_fuzz_targetS2_E3$_1Z25local_address_fuzz_targetS2_E3$_2Z25local_address_fuzz_targetS2_E3$_3Z25local_address_fuzz_targetS2_E3$_4Z25local_address_fuzz_targetS2_E3$_5EEmR18FuzzedDataProviderDpT_ p2p_headers_presync.cpp:_Z9CallOneOfIJZ31p2p_headers_presync_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_3Z31p2p_headers_presync_fuzz_targetS2_E3$_4Z31p2p_headers_presync_fuzz_targetS2_E3$_5EEmR18FuzzedDataProviderDpT_ Line | Count | Source | 36 | 23.6k | { | 37 | 23.6k | constexpr size_t call_size{sizeof...(callables)}; | 38 | 23.6k | static_assert(call_size >= 1); | 39 | 23.6k | const size_t call_index{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, call_size - 1)}; | 40 | | | 41 | 23.6k | size_t i{0}; | 42 | 71.0k | ((i++ == call_index ? callables() : void()), ...); | 43 | 23.6k | return call_size; | 44 | 23.6k | } |
Unexecuted instantiation: p2p_transport_serialization.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_114SimulationTestITk21RandomNumberGenerator21InsecureRandomContextEEvR9TransportS4_RT_R18FuzzedDataProviderEUlvE0_ZNS1_ITk21RandomNumberGeneratorS2_EEvS4_S4_S6_S8_EUlvE1_ZNS1_ITk21RandomNumberGeneratorS2_EEvS4_S4_S6_S8_EUlvE2_ZNS1_ITk21RandomNumberGeneratorS2_EEvS4_S4_S6_S8_EUlvE3_ZNS1_ITk21RandomNumberGeneratorS2_EEvS4_S4_S6_S8_EUlvE4_ZNS1_ITk21RandomNumberGeneratorS2_EEvS4_S4_S6_S8_EUlvE5_EEmS8_DpT_ Unexecuted instantiation: policy_estimator.cpp:_Z9CallOneOfIJZ28policy_estimator_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z28policy_estimator_fuzz_targetS2_E3$_1Z28policy_estimator_fuzz_targetS2_E3$_2Z28policy_estimator_fuzz_targetS2_E3$_3EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZ25pool_resource_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z25pool_resource_fuzz_targetS2_E3$_1Z25pool_resource_fuzz_targetS2_E3$_2Z25pool_resource_fuzz_targetS2_E3$_3Z25pool_resource_fuzz_targetS2_E3$_4Z25pool_resource_fuzz_targetS2_E3$_5Z25pool_resource_fuzz_targetS2_E3$_6Z25pool_resource_fuzz_targetS2_E3$_7EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm128ELm1EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm128ELm2EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm128ELm4EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm128ELm8EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm8ELm8EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm16ELm16EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm256ELm16EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: poolresource.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118PoolResourceFuzzerILm256ELm64EE4FuzzEvEUlvE_ZNS2_4FuzzEvEUlvE0_EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: rolling_bloom_filter.cpp:_Z9CallOneOfIJZ32rolling_bloom_filter_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z32rolling_bloom_filter_fuzz_targetS2_E3$_1Z32rolling_bloom_filter_fuzz_targetS2_E3$_2EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: rpc.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_124ConsumeScalarRPCArgumentB5cxx11ER18FuzzedDataProviderRbE3$_0ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_1ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_2ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_3ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_4ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_5ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_6ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_7ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_8ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E3$_9ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_10ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_11ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_12ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_13ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_14ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_15ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_16ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_17ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_18ZNS0_24ConsumeScalarRPCArgumentB5cxx11ES2_S3_E4$_19EEmS2_DpT_ Unexecuted instantiation: script_ops.cpp:_Z9CallOneOfIJZ22script_ops_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z22script_ops_fuzz_targetS2_E3$_1Z22script_ops_fuzz_targetS2_E3$_2Z22script_ops_fuzz_targetS2_E3$_3Z22script_ops_fuzz_targetS2_E3$_4Z22script_ops_fuzz_targetS2_E3$_5Z22script_ops_fuzz_targetS2_E3$_6EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: scriptnum_ops.cpp:_Z9CallOneOfIJZ25scriptnum_ops_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z25scriptnum_ops_fuzz_targetS2_E3$_1Z25scriptnum_ops_fuzz_targetS2_E3$_2Z25scriptnum_ops_fuzz_targetS2_E3$_3Z25scriptnum_ops_fuzz_targetS2_E3$_4Z25scriptnum_ops_fuzz_targetS2_E3$_5Z25scriptnum_ops_fuzz_targetS2_E3$_6Z25scriptnum_ops_fuzz_targetS2_E3$_7Z25scriptnum_ops_fuzz_targetS2_E3$_8Z25scriptnum_ops_fuzz_targetS2_E3$_9Z25scriptnum_ops_fuzz_targetS2_E4$_10Z25scriptnum_ops_fuzz_targetS2_E4$_11EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: strprintf.cpp:_Z9CallOneOfIJZ22str_printf_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z22str_printf_fuzz_targetS2_E3$_1Z22str_printf_fuzz_targetS2_E3$_2Z22str_printf_fuzz_targetS2_E3$_3Z22str_printf_fuzz_targetS2_E3$_4Z22str_printf_fuzz_targetS2_E3$_5EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: strprintf.cpp:_Z9CallOneOfIJZ22str_printf_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_6Z22str_printf_fuzz_targetS2_E3$_7Z22str_printf_fuzz_targetS2_E3$_8Z22str_printf_fuzz_targetS2_E3$_9Z22str_printf_fuzz_targetS2_E4$_10Z22str_printf_fuzz_targetS2_E4$_11Z22str_printf_fuzz_targetS2_E4$_12Z22str_printf_fuzz_targetS2_E4$_13EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: system.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_118system_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS0_18system_fuzz_targetES3_E3$_1ZNS0_18system_fuzz_targetES3_E3$_2ZNS0_18system_fuzz_targetES3_E3$_3ZNS0_18system_fuzz_targetES3_E3$_4ZNS0_18system_fuzz_targetES3_E3$_5ZNS0_18system_fuzz_targetES3_E3$_6ZNS0_18system_fuzz_targetES3_E3$_7EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: torcontrol.cpp:_Z9CallOneOfIJZ22torcontrol_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_0Z22torcontrol_fuzz_targetS2_E3$_1Z22torcontrol_fuzz_targetS2_E3$_2EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: torcontrol.cpp:_Z9CallOneOfIJZ22torcontrol_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_3Z22torcontrol_fuzz_targetS2_E3$_4Z22torcontrol_fuzz_targetS2_E3$_5Z22torcontrol_fuzz_targetS2_E3$_6EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: txdownloadman.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_125txdownloadman_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS0_25txdownloadman_fuzz_targetES3_E3$_1ZNS0_25txdownloadman_fuzz_targetES3_E3$_2ZNS0_25txdownloadman_fuzz_targetES3_E3$_3ZNS0_25txdownloadman_fuzz_targetES3_E3$_4ZNS0_25txdownloadman_fuzz_targetES3_E3$_5ZNS0_25txdownloadman_fuzz_targetES3_E3$_6ZNS0_25txdownloadman_fuzz_targetES3_E3$_7ZNS0_25txdownloadman_fuzz_targetES3_E3$_8ZNS0_25txdownloadman_fuzz_targetES3_E3$_9ZNS0_25txdownloadman_fuzz_targetES3_E4$_10ZNS0_25txdownloadman_fuzz_targetES3_E4$_11EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: txdownloadman.cpp:_Z9CallOneOfIJZN12_GLOBAL__N_130txdownloadman_impl_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_1ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_2ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_3ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_4ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_5ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_6ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_7ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_8ZNS0_30txdownloadman_impl_fuzz_targetES3_E3$_9ZNS0_30txdownloadman_impl_fuzz_targetES3_E4$_10ZNS0_30txdownloadman_impl_fuzz_targetES3_E4$_11EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: txorphan.cpp:_Z9CallOneOfIJZ20txorphan_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_2Z20txorphan_fuzz_targetS2_E3$_3Z20txorphan_fuzz_targetS2_E3$_4Z20txorphan_fuzz_targetS2_E3$_5Z20txorphan_fuzz_targetS2_E3$_6Z20txorphan_fuzz_targetS2_E3$_7Z20txorphan_fuzz_targetS2_E3$_8EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: utxo_total_supply.cpp:_Z9CallOneOfIJZ29utxo_total_supply_fuzz_targetSt4spanIKhLm18446744073709551615EEE3$_5Z29utxo_total_supply_fuzz_targetS2_E3$_6Z29utxo_total_supply_fuzz_targetS2_E3$_7EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: coincontrol.cpp:_Z9CallOneOfIJZN6wallet12_GLOBAL__N_123coincontrol_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS1_23coincontrol_fuzz_targetES4_E3$_1ZNS1_23coincontrol_fuzz_targetES4_E3$_2ZNS1_23coincontrol_fuzz_targetES4_E3$_3ZNS1_23coincontrol_fuzz_targetES4_E3$_4ZNS1_23coincontrol_fuzz_targetES4_E3$_5ZNS1_23coincontrol_fuzz_targetES4_E3$_6ZNS1_23coincontrol_fuzz_targetES4_E3$_7ZNS1_23coincontrol_fuzz_targetES4_E3$_8ZNS1_23coincontrol_fuzz_targetES4_E3$_9ZNS1_23coincontrol_fuzz_targetES4_E4$_10ZNS1_23coincontrol_fuzz_targetES4_E4$_11EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: crypter.cpp:_Z9CallOneOfIJZN6wallet12_GLOBAL__N_119crypter_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS1_19crypter_fuzz_targetES4_E3$_1ZNS1_19crypter_fuzz_targetES4_E3$_2ZNS1_19crypter_fuzz_targetES4_E3$_3ZNS1_19crypter_fuzz_targetES4_E3$_4ZNS1_19crypter_fuzz_targetES4_E3$_5ZNS1_19crypter_fuzz_targetES4_E3$_6EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: notifications.cpp:_Z9CallOneOfIJZN6wallet12_GLOBAL__N_132wallet_notifications_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS1_32wallet_notifications_fuzz_targetES4_E3$_1EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: _Z9CallOneOfIJZN6wallet12FuzzedWallet6FundTxER18FuzzedDataProvider19CMutableTransactionEUlvE_ZNS1_6FundTxES3_S4_EUlvE0_ZNS1_6FundTxES3_S4_EUlvE1_EEmS3_DpT_ Unexecuted instantiation: _Z9CallOneOfIJZN6wallet12FuzzedWallet6FundTxER18FuzzedDataProvider19CMutableTransactionEUlvE2_ZNS1_6FundTxES3_S4_EUlvE3_ZNS1_6FundTxES3_S4_EUlvE4_EEmS3_DpT_ Unexecuted instantiation: scriptpubkeyman.cpp:_Z9CallOneOfIJZN6wallet12_GLOBAL__N_127scriptpubkeyman_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS1_27scriptpubkeyman_fuzz_targetES4_E3$_1ZNS1_27scriptpubkeyman_fuzz_targetES4_E3$_2ZNS1_27scriptpubkeyman_fuzz_targetES4_E3$_3ZNS1_27scriptpubkeyman_fuzz_targetES4_E3$_4ZNS1_27scriptpubkeyman_fuzz_targetES4_E3$_5EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: spend.cpp:_Z9CallOneOfIJZN6wallet12_GLOBAL__N_137wallet_create_transaction_fuzz_targetESt4spanIKhLm18446744073709551615EEE3$_0ZNS1_37wallet_create_transaction_fuzz_targetES4_E3$_1ZNS1_37wallet_create_transaction_fuzz_targetES4_E3$_2EEmR18FuzzedDataProviderDpT_ Unexecuted instantiation: util.cpp:_Z9CallOneOfIJZ13ConsumeScriptR18FuzzedDataProviderbE3$_0Z13ConsumeScriptS1_bE3$_1Z13ConsumeScriptS1_bE3$_2Z13ConsumeScriptS1_bE3$_3Z13ConsumeScriptS1_bE3$_4Z13ConsumeScriptS1_bE3$_5Z13ConsumeScriptS1_bE3$_6EEmS1_DpT_ Unexecuted instantiation: util.cpp:_Z9CallOneOfIJZ20ConsumeTxDestinationR18FuzzedDataProviderE3$_0Z20ConsumeTxDestinationS1_E3$_1Z20ConsumeTxDestinationS1_E3$_2Z20ConsumeTxDestinationS1_E3$_3Z20ConsumeTxDestinationS1_E3$_4Z20ConsumeTxDestinationS1_E3$_5Z20ConsumeTxDestinationS1_E3$_6Z20ConsumeTxDestinationS1_E3$_7Z20ConsumeTxDestinationS1_E3$_8EEmS1_DpT_ Unexecuted instantiation: util.cpp:_Z9CallOneOfIJZN18FuzzedFileProvider4openEvE3$_0ZNS0_4openEvE3$_1ZNS0_4openEvE3$_2ZNS0_4openEvE3$_3ZNS0_4openEvE3$_4ZNS0_4openEvE3$_5EEmR18FuzzedDataProviderDpT_ |
45 | | |
46 | | template <typename Collection> |
47 | | auto& PickValue(FuzzedDataProvider& fuzzed_data_provider, Collection& col) |
48 | 23.6k | { |
49 | 23.6k | auto sz{col.size()}; |
50 | 23.6k | assert(sz >= 1); |
51 | 23.6k | auto it = col.begin(); |
52 | 23.6k | std::advance(it, fuzzed_data_provider.ConsumeIntegralInRange<decltype(sz)>(0, sz - 1)); |
53 | 23.6k | return *it; |
54 | 23.6k | } Unexecuted instantiation: _Z9PickValueIKSt5arrayIN10miniscript4TypeELm4EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueIKSt6vectorISt4pairIN10miniscript8FragmentES0_INS2_4TypeESaIS4_EEESaIS7_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt6vectorIS0_IhSaIhEESaIS2_EEERDaR18FuzzedDataProviderRT_ _Z9PickValueISt6vectorIP5CNodeSaIS2_EEERDaR18FuzzedDataProviderRT_ Line | Count | Source | 48 | 23.6k | { | 49 | 23.6k | auto sz{col.size()}; | 50 | 23.6k | assert(sz >= 1); | 51 | 23.6k | auto it = col.begin(); | 52 | 23.6k | std::advance(it, fuzzed_data_provider.ConsumeIntegralInRange<decltype(sz)>(0, sz - 1)); | 53 | 23.6k | return *it; | 54 | 23.6k | } |
Unexecuted instantiation: _Z9PickValueIKSt5arrayINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELm35EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt3setI9COutPointSt4lessIS1_ESaIS1_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt6vectorISt10unique_ptrI11CBlockIndexSt14default_deleteIS2_EESaIS5_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueIKSt6vectorI13TxMempoolInfoSaIS1_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt6vectorI22transaction_identifierILb0EESaIS2_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt6vectorI9COutPointSaIS1_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt6vectorISt10shared_ptrIK12CTransactionESaIS4_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueISt13unordered_setI7CScript15SaltedSipHasherSt8equal_toIS1_ESaIS1_EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueIKSt5arrayIN8CNetAddr8EncodingELm2EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueIKSt5arrayIN8CAddress6FormatELm2EEERDaR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z9PickValueIKSt6vectorI22transaction_identifierILb0EESaIS2_EEERDaR18FuzzedDataProviderRT_ |
55 | | |
56 | | template<typename B = uint8_t> |
57 | | [[nodiscard]] inline std::vector<B> ConsumeRandomLengthByteVector(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept |
58 | 0 | { |
59 | 0 | static_assert(sizeof(B) == 1); |
60 | 0 | const std::string s = max_length ? |
61 | 0 | fuzzed_data_provider.ConsumeRandomLengthString(*max_length) : |
62 | 0 | fuzzed_data_provider.ConsumeRandomLengthString(); |
63 | 0 | std::vector<B> ret(s.size()); |
64 | 0 | std::copy(s.begin(), s.end(), reinterpret_cast<char*>(ret.data())); |
65 | 0 | return ret; |
66 | 0 | } Unexecuted instantiation: _Z29ConsumeRandomLengthByteVectorIhESt6vectorIT_SaIS1_EER18FuzzedDataProviderRKSt8optionalImE Unexecuted instantiation: _Z29ConsumeRandomLengthByteVectorISt4byteESt6vectorIT_SaIS2_EER18FuzzedDataProviderRKSt8optionalImE |
67 | | |
68 | | [[nodiscard]] inline std::vector<bool> ConsumeRandomLengthBitVector(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept |
69 | 0 | { |
70 | 0 | return BytesToBits(ConsumeRandomLengthByteVector(fuzzed_data_provider, max_length)); |
71 | 0 | } |
72 | | |
73 | | [[nodiscard]] inline DataStream ConsumeDataStream(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept |
74 | 0 | { |
75 | 0 | return DataStream{ConsumeRandomLengthByteVector(fuzzed_data_provider, max_length)}; |
76 | 0 | } |
77 | | |
78 | | [[nodiscard]] inline std::vector<std::string> ConsumeRandomLengthStringVector(FuzzedDataProvider& fuzzed_data_provider, const size_t max_vector_size = 16, const size_t max_string_length = 16) noexcept |
79 | 0 | { |
80 | 0 | const size_t n_elements = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, max_vector_size); |
81 | 0 | std::vector<std::string> r; |
82 | 0 | r.reserve(n_elements); |
83 | 0 | for (size_t i = 0; i < n_elements; ++i) { |
84 | 0 | r.push_back(fuzzed_data_provider.ConsumeRandomLengthString(max_string_length)); |
85 | 0 | } |
86 | 0 | return r; |
87 | 0 | } |
88 | | |
89 | | template <typename T> |
90 | | [[nodiscard]] inline std::vector<T> ConsumeRandomLengthIntegralVector(FuzzedDataProvider& fuzzed_data_provider, const size_t max_vector_size = 16) noexcept |
91 | 0 | { |
92 | 0 | const size_t n_elements = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, max_vector_size); |
93 | 0 | std::vector<T> r; |
94 | 0 | r.reserve(n_elements); |
95 | 0 | for (size_t i = 0; i < n_elements; ++i) { |
96 | 0 | r.push_back(fuzzed_data_provider.ConsumeIntegral<T>()); |
97 | 0 | } |
98 | 0 | return r; |
99 | 0 | } Unexecuted instantiation: _Z33ConsumeRandomLengthIntegralVectorIhESt6vectorIT_SaIS1_EER18FuzzedDataProviderm Unexecuted instantiation: _Z33ConsumeRandomLengthIntegralVectorIjESt6vectorIT_SaIS1_EER18FuzzedDataProviderm Unexecuted instantiation: _Z33ConsumeRandomLengthIntegralVectorIlESt6vectorIT_SaIS1_EER18FuzzedDataProviderm |
100 | | |
101 | | template <typename P> |
102 | | [[nodiscard]] P ConsumeDeserializationParams(FuzzedDataProvider& fuzzed_data_provider) noexcept; |
103 | | |
104 | | template <typename T, typename P> |
105 | | [[nodiscard]] std::optional<T> ConsumeDeserializable(FuzzedDataProvider& fuzzed_data_provider, const P& params, const std::optional<size_t>& max_length = std::nullopt) noexcept |
106 | 0 | { |
107 | 0 | const std::vector<uint8_t> buffer{ConsumeRandomLengthByteVector(fuzzed_data_provider, max_length)}; |
108 | 0 | DataStream ds{buffer}; |
109 | 0 | T obj; |
110 | 0 | try { |
111 | 0 | ds >> params(obj); |
112 | 0 | } catch (const std::ios_base::failure&) { |
113 | 0 | return std::nullopt; |
114 | 0 | } |
115 | 0 | return obj; |
116 | 0 | } Unexecuted instantiation: _Z21ConsumeDeserializableI19CMutableTransaction20TransactionSerParamsESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS2_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI8AddrInfoN8CAddress9SerParamsEESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS3_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI8CNetAddrNS0_9SerParamsEESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS2_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI8CServiceN8CNetAddr9SerParamsEESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS3_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI8CAddressNS0_9SerParamsEESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS2_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI6CBlock20TransactionSerParamsESt8optionalIT_ER18FuzzedDataProviderRKT0_RKS2_ImE |
117 | | |
118 | | template <typename T> |
119 | | [[nodiscard]] inline std::optional<T> ConsumeDeserializable(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept |
120 | 0 | { |
121 | 0 | const std::vector<uint8_t> buffer = ConsumeRandomLengthByteVector(fuzzed_data_provider, max_length); |
122 | 0 | DataStream ds{buffer}; |
123 | 0 | T obj; |
124 | 0 | try { |
125 | 0 | ds >> obj; |
126 | 0 | } catch (const std::ios_base::failure&) { |
127 | 0 | return std::nullopt; |
128 | 0 | } |
129 | 0 | return obj; |
130 | 0 | } Unexecuted instantiation: _Z21ConsumeDeserializableI12CBlockHeaderESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI13CBlockLocatorESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI14CBlockFileInfoESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI11BlockFilterESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI9COutPointESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI7uint256ESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI15CDiskBlockIndexESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI4CoinESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI11FlatFilePosESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableISt6vectorI12CBlockHeaderSaIS1_EEESt8optionalIT_ER18FuzzedDataProviderRKS4_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI18CPartialMerkleTreeESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI7CScriptESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI4CInvESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI26PartiallySignedTransactionESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI7CPubKeyESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI13KeyOriginInfoESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE Unexecuted instantiation: _Z21ConsumeDeserializableI6CTxOutESt8optionalIT_ER18FuzzedDataProviderRKS1_ImE |
131 | | |
132 | | template <typename WeakEnumType, size_t size> |
133 | | [[nodiscard]] WeakEnumType ConsumeWeakEnum(FuzzedDataProvider& fuzzed_data_provider, const WeakEnumType (&all_types)[size]) noexcept |
134 | 0 | { |
135 | 0 | return fuzzed_data_provider.ConsumeBool() ? |
136 | 0 | fuzzed_data_provider.PickValueInArray<WeakEnumType>(all_types) : |
137 | 0 | WeakEnumType(fuzzed_data_provider.ConsumeIntegral<std::underlying_type_t<WeakEnumType>>()); |
138 | 0 | } Unexecuted instantiation: _Z15ConsumeWeakEnumI12ServiceFlagsLm7EET_R18FuzzedDataProviderRAT0__KS1_ Unexecuted instantiation: _Z15ConsumeWeakEnumI18NetPermissionFlagsLm10EET_R18FuzzedDataProviderRAT0__KS1_ |
139 | | |
140 | | [[nodiscard]] inline opcodetype ConsumeOpcodeType(FuzzedDataProvider& fuzzed_data_provider) noexcept |
141 | 0 | { |
142 | 0 | return static_cast<opcodetype>(fuzzed_data_provider.ConsumeIntegralInRange<uint32_t>(0, MAX_OPCODE)); |
143 | 0 | } |
144 | | |
145 | | [[nodiscard]] CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::optional<CAmount>& max = std::nullopt) noexcept; |
146 | | |
147 | | [[nodiscard]] int64_t ConsumeTime(FuzzedDataProvider& fuzzed_data_provider, const std::optional<int64_t>& min = std::nullopt, const std::optional<int64_t>& max = std::nullopt) noexcept; |
148 | | |
149 | | [[nodiscard]] CMutableTransaction ConsumeTransaction(FuzzedDataProvider& fuzzed_data_provider, const std::optional<std::vector<Txid>>& prevout_txids, const int max_num_in = 10, const int max_num_out = 10) noexcept; |
150 | | |
151 | | [[nodiscard]] CScriptWitness ConsumeScriptWitness(FuzzedDataProvider& fuzzed_data_provider, const size_t max_stack_elem_size = 32) noexcept; |
152 | | |
153 | | [[nodiscard]] CScript ConsumeScript(FuzzedDataProvider& fuzzed_data_provider, const bool maybe_p2wsh = false) noexcept; |
154 | | |
155 | | [[nodiscard]] uint32_t ConsumeSequence(FuzzedDataProvider& fuzzed_data_provider) noexcept; |
156 | | |
157 | | [[nodiscard]] inline CScriptNum ConsumeScriptNum(FuzzedDataProvider& fuzzed_data_provider) noexcept |
158 | 0 | { |
159 | 0 | return CScriptNum{fuzzed_data_provider.ConsumeIntegral<int64_t>()}; |
160 | 0 | } |
161 | | |
162 | | [[nodiscard]] inline uint160 ConsumeUInt160(FuzzedDataProvider& fuzzed_data_provider) noexcept |
163 | 0 | { |
164 | 0 | const std::vector<uint8_t> v160 = fuzzed_data_provider.ConsumeBytes<uint8_t>(160 / 8); |
165 | 0 | if (v160.size() != 160 / 8) { |
166 | 0 | return {}; |
167 | 0 | } |
168 | 0 | return uint160{v160}; |
169 | 0 | } |
170 | | |
171 | | [[nodiscard]] inline uint256 ConsumeUInt256(FuzzedDataProvider& fuzzed_data_provider) noexcept |
172 | 9.72k | { |
173 | 9.72k | const std::vector<uint8_t> v256 = fuzzed_data_provider.ConsumeBytes<uint8_t>(256 / 8); |
174 | 9.72k | if (v256.size() != 256 / 8) { |
175 | 6.57k | return {}; |
176 | 6.57k | } |
177 | 3.14k | return uint256{v256}; |
178 | 9.72k | } |
179 | | |
180 | | [[nodiscard]] inline arith_uint256 ConsumeArithUInt256(FuzzedDataProvider& fuzzed_data_provider) noexcept |
181 | 9.72k | { |
182 | 9.72k | return UintToArith256(ConsumeUInt256(fuzzed_data_provider)); |
183 | 9.72k | } |
184 | | |
185 | | [[nodiscard]] inline arith_uint256 ConsumeArithUInt256InRange(FuzzedDataProvider& fuzzed_data_provider, const arith_uint256& min, const arith_uint256& max) noexcept |
186 | 9.72k | { |
187 | 9.72k | assert(min <= max); |
188 | 9.72k | const arith_uint256 range = max - min; |
189 | 9.72k | const arith_uint256 value = ConsumeArithUInt256(fuzzed_data_provider); |
190 | 9.72k | arith_uint256 result = value; |
191 | | // Avoid division by 0, in case range + 1 results in overflow. |
192 | 9.72k | if (range != ~arith_uint256(0)) { |
193 | 9.72k | const arith_uint256 quotient = value / (range + 1); |
194 | 9.72k | result = value - (quotient * (range + 1)); |
195 | 9.72k | } |
196 | 9.72k | result += min; |
197 | 9.72k | assert(result >= min && result <= max); |
198 | 9.72k | return result; |
199 | 9.72k | } |
200 | | |
201 | | [[nodiscard]] std::map<COutPoint, Coin> ConsumeCoins(FuzzedDataProvider& fuzzed_data_provider) noexcept; |
202 | | |
203 | | [[nodiscard]] CTxDestination ConsumeTxDestination(FuzzedDataProvider& fuzzed_data_provider) noexcept; |
204 | | |
205 | | [[nodiscard]] CKey ConsumePrivateKey(FuzzedDataProvider& fuzzed_data_provider, std::optional<bool> compressed = std::nullopt) noexcept; |
206 | | |
207 | | template <typename T> |
208 | | [[nodiscard]] bool MultiplicationOverflow(const T i, const T j) noexcept |
209 | 0 | { |
210 | 0 | static_assert(std::is_integral_v<T>, "Integral required."); |
211 | 0 | if (std::numeric_limits<T>::is_signed) { |
212 | 0 | if (i > 0) { |
213 | 0 | if (j > 0) { |
214 | 0 | return i > (std::numeric_limits<T>::max() / j); |
215 | 0 | } else { |
216 | 0 | return j < (std::numeric_limits<T>::min() / i); |
217 | 0 | } |
218 | 0 | } else { |
219 | 0 | if (j > 0) { |
220 | 0 | return i < (std::numeric_limits<T>::min() / j); |
221 | 0 | } else { |
222 | 0 | return i != 0 && (j < (std::numeric_limits<T>::max() / i)); |
223 | 0 | } |
224 | 0 | } |
225 | 0 | } else { |
226 | 0 | return j != 0 && i > std::numeric_limits<T>::max() / j; |
227 | 0 | } |
228 | 0 | } Unexecuted instantiation: _Z22MultiplicationOverflowIlEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowImEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIiEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIjEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIsEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowItEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIcEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIhEbT_S0_ Unexecuted instantiation: _Z22MultiplicationOverflowIaEbT_S0_ |
229 | | |
230 | | [[nodiscard]] bool ContainsSpentInput(const CTransaction& tx, const CCoinsViewCache& inputs) noexcept; |
231 | | |
232 | | /** |
233 | | * Sets errno to a value selected from the given std::array `errnos`. |
234 | | */ |
235 | | template <typename T, size_t size> |
236 | | void SetFuzzedErrNo(FuzzedDataProvider& fuzzed_data_provider, const std::array<T, size>& errnos) |
237 | 0 | { |
238 | 0 | errno = fuzzed_data_provider.PickValueInArray(errnos); |
239 | 0 | } Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm18EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm10EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm8EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm4EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm3EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE Unexecuted instantiation: _Z14SetFuzzedErrNoIiLm2EEvR18FuzzedDataProviderRKSt5arrayIT_XT0_EE |
240 | | |
241 | | /* |
242 | | * Sets a fuzzed errno in the range [0, 133 (EHWPOISON)]. Can be used from functions emulating |
243 | | * standard library functions that set errno, or in other contexts where the value of errno |
244 | | * might be relevant for the execution path that will be taken. |
245 | | */ |
246 | | inline void SetFuzzedErrNo(FuzzedDataProvider& fuzzed_data_provider) noexcept |
247 | 0 | { |
248 | 0 | errno = fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 133); |
249 | 0 | } |
250 | | |
251 | | /** |
252 | | * Returns a byte vector of specified size regardless of the number of remaining bytes available |
253 | | * from the fuzzer. Pads with zero value bytes if needed to achieve the specified size. |
254 | | */ |
255 | | template<typename B = uint8_t> |
256 | | [[nodiscard]] inline std::vector<B> ConsumeFixedLengthByteVector(FuzzedDataProvider& fuzzed_data_provider, const size_t length) noexcept |
257 | 0 | { |
258 | 0 | static_assert(sizeof(B) == 1); |
259 | 0 | auto random_bytes = fuzzed_data_provider.ConsumeBytes<B>(length); |
260 | 0 | random_bytes.resize(length); |
261 | 0 | return random_bytes; |
262 | 0 | } Unexecuted instantiation: _Z28ConsumeFixedLengthByteVectorIhESt6vectorIT_SaIS1_EER18FuzzedDataProviderm Unexecuted instantiation: _Z28ConsumeFixedLengthByteVectorISt4byteESt6vectorIT_SaIS2_EER18FuzzedDataProviderm |
263 | | |
264 | | class FuzzedFileProvider |
265 | | { |
266 | | FuzzedDataProvider& m_fuzzed_data_provider; |
267 | | int64_t m_offset = 0; |
268 | | |
269 | | public: |
270 | 0 | FuzzedFileProvider(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider{fuzzed_data_provider} |
271 | 0 | { |
272 | 0 | } |
273 | | |
274 | | FILE* open(); |
275 | | |
276 | | static ssize_t read(void* cookie, char* buf, size_t size); |
277 | | |
278 | | static ssize_t write(void* cookie, const char* buf, size_t size); |
279 | | |
280 | | static int seek(void* cookie, int64_t* offset, int whence); |
281 | | |
282 | | static int close(void* cookie); |
283 | | }; |
284 | | |
285 | | #define WRITE_TO_STREAM_CASE(type, consume) \ |
286 | 0 | [&] { \ |
287 | 0 | type o = consume; \ |
288 | 0 | stream << o; \ |
289 | 0 | } Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE0_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE1_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE2_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE3_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE4_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE5_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE6_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE7_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE8_clEv Unexecuted instantiation: _ZZ13WriteToStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE9_clEv |
290 | | template <typename Stream> |
291 | | void WriteToStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) noexcept |
292 | 0 | { |
293 | 0 | while (fuzzed_data_provider.ConsumeBool()) { |
294 | 0 | try { |
295 | 0 | CallOneOf( |
296 | 0 | fuzzed_data_provider, |
297 | 0 | WRITE_TO_STREAM_CASE(bool, fuzzed_data_provider.ConsumeBool()), |
298 | 0 | WRITE_TO_STREAM_CASE(int8_t, fuzzed_data_provider.ConsumeIntegral<int8_t>()), |
299 | 0 | WRITE_TO_STREAM_CASE(uint8_t, fuzzed_data_provider.ConsumeIntegral<uint8_t>()), |
300 | 0 | WRITE_TO_STREAM_CASE(int16_t, fuzzed_data_provider.ConsumeIntegral<int16_t>()), |
301 | 0 | WRITE_TO_STREAM_CASE(uint16_t, fuzzed_data_provider.ConsumeIntegral<uint16_t>()), |
302 | 0 | WRITE_TO_STREAM_CASE(int32_t, fuzzed_data_provider.ConsumeIntegral<int32_t>()), |
303 | 0 | WRITE_TO_STREAM_CASE(uint32_t, fuzzed_data_provider.ConsumeIntegral<uint32_t>()), |
304 | 0 | WRITE_TO_STREAM_CASE(int64_t, fuzzed_data_provider.ConsumeIntegral<int64_t>()), |
305 | 0 | WRITE_TO_STREAM_CASE(uint64_t, fuzzed_data_provider.ConsumeIntegral<uint64_t>()), |
306 | 0 | WRITE_TO_STREAM_CASE(std::string, fuzzed_data_provider.ConsumeRandomLengthString(32)), |
307 | 0 | WRITE_TO_STREAM_CASE(std::vector<uint8_t>, ConsumeRandomLengthIntegralVector<uint8_t>(fuzzed_data_provider))); |
308 | 0 | } catch (const std::ios_base::failure&) { |
309 | 0 | break; |
310 | 0 | } |
311 | 0 | } |
312 | 0 | } |
313 | | |
314 | | #define READ_FROM_STREAM_CASE(type) \ |
315 | 0 | [&] { \ |
316 | 0 | type o; \ |
317 | 0 | stream >> o; \ |
318 | 0 | } Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE0_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE1_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE2_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE3_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE4_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE5_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE6_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE7_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE8_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ENKUlvE9_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE0_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE1_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE2_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE3_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE4_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE5_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE6_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE7_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE8_clEv Unexecuted instantiation: _ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE9_clEv |
319 | | template <typename Stream> |
320 | | void ReadFromStream(FuzzedDataProvider& fuzzed_data_provider, Stream& stream) noexcept |
321 | 0 | { |
322 | 0 | while (fuzzed_data_provider.ConsumeBool()) { |
323 | 0 | try { |
324 | 0 | CallOneOf( |
325 | 0 | fuzzed_data_provider, |
326 | 0 | READ_FROM_STREAM_CASE(bool), |
327 | 0 | READ_FROM_STREAM_CASE(int8_t), |
328 | 0 | READ_FROM_STREAM_CASE(uint8_t), |
329 | 0 | READ_FROM_STREAM_CASE(int16_t), |
330 | 0 | READ_FROM_STREAM_CASE(uint16_t), |
331 | 0 | READ_FROM_STREAM_CASE(int32_t), |
332 | 0 | READ_FROM_STREAM_CASE(uint32_t), |
333 | 0 | READ_FROM_STREAM_CASE(int64_t), |
334 | 0 | READ_FROM_STREAM_CASE(uint64_t), |
335 | 0 | READ_FROM_STREAM_CASE(std::string), |
336 | 0 | READ_FROM_STREAM_CASE(std::vector<uint8_t>)); |
337 | 0 | } catch (const std::ios_base::failure&) { |
338 | 0 | break; |
339 | 0 | } |
340 | 0 | } |
341 | 0 | } Unexecuted instantiation: _Z14ReadFromStreamI8AutoFileEvR18FuzzedDataProviderRT_ Unexecuted instantiation: _Z14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ |
342 | | |
343 | | #endif // BITCOIN_TEST_FUZZ_UTIL_H |