| 39 | } |
| 40 | |
| 41 | FUZZ_TARGET_INIT(script, initialize_script) |
| 42 | { |
| 43 | FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); |
| 44 | const CScript script{ConsumeScript(fuzzed_data_provider)}; |
| 45 | |
| 46 | CompressedScript compressed; |
| 47 | if (CompressScript(script, compressed)) { |
| 48 | const unsigned int size = compressed[0]; |
| 49 | compressed.erase(compressed.begin()); |
| 50 | assert(size <= 5); |
| 51 | CScript decompressed_script; |
| 52 | const bool ok = DecompressScript(decompressed_script, size, compressed); |
| 53 | assert(ok); |
| 54 | assert(script == decompressed_script); |
| 55 | } |
| 56 | |
| 57 | TxoutType which_type; |
| 58 | bool is_standard_ret = IsStandard(script, which_type); |
| 59 | if (!is_standard_ret) { |
| 60 | assert(which_type == TxoutType::NONSTANDARD || |
| 61 | which_type == TxoutType::NULL_DATA || |
| 62 | which_type == TxoutType::MULTISIG); |
| 63 | } |
| 64 | if (which_type == TxoutType::NONSTANDARD) { |
| 65 | assert(!is_standard_ret); |
| 66 | } |
| 67 | if (which_type == TxoutType::NULL_DATA) { |
| 68 | assert(script.IsUnspendable()); |
| 69 | } |
| 70 | if (script.IsUnspendable()) { |
| 71 | assert(which_type == TxoutType::NULL_DATA || |
| 72 | which_type == TxoutType::NONSTANDARD); |
| 73 | } |
| 74 | |
| 75 | CTxDestination address; |
| 76 | bool extract_destination_ret = ExtractDestination(script, address); |
| 77 | if (!extract_destination_ret) { |
| 78 | assert(which_type == TxoutType::PUBKEY || |
| 79 | which_type == TxoutType::NONSTANDARD || |
| 80 | which_type == TxoutType::NULL_DATA || |
| 81 | which_type == TxoutType::MULTISIG); |
| 82 | } |
| 83 | if (which_type == TxoutType::NONSTANDARD || |
| 84 | which_type == TxoutType::NULL_DATA || |
| 85 | which_type == TxoutType::MULTISIG) { |
| 86 | assert(!extract_destination_ret); |
| 87 | } |
| 88 | |
| 89 | const FlatSigningProvider signing_provider; |
| 90 | (void)InferDescriptor(script, signing_provider); |
| 91 | (void)IsSegWitOutput(signing_provider, script); |
| 92 | (void)IsSolvable(signing_provider, script); |
| 93 | |
| 94 | (void)RecursiveDynamicUsage(script); |
| 95 | |
| 96 | std::vector<std::vector<unsigned char>> solutions; |
| 97 | (void)Solver(script, solutions); |
| 98 |
nothing calls this directly
no test coverage detected