| 17 | bool CastToBool(const std::vector<unsigned char>& vch); |
| 18 | |
| 19 | FUZZ_TARGET(script_interpreter) |
| 20 | { |
| 21 | FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); |
| 22 | { |
| 23 | const CScript script_code = ConsumeScript(fuzzed_data_provider); |
| 24 | const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider); |
| 25 | if (mtx) { |
| 26 | const CTransaction tx_to{*mtx}; |
| 27 | const unsigned int in = fuzzed_data_provider.ConsumeIntegral<unsigned int>(); |
| 28 | if (in < tx_to.vin.size()) { |
| 29 | (void)SignatureHash(script_code, tx_to, in, fuzzed_data_provider.ConsumeIntegral<int>(), ConsumeMoney(fuzzed_data_provider), fuzzed_data_provider.PickValueInArray({SigVersion::BASE, SigVersion::WITNESS_V0}), 0, nullptr); |
| 30 | const std::optional<CMutableTransaction> mtx_precomputed = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider); |
| 31 | if (mtx_precomputed) { |
| 32 | const CTransaction tx_precomputed{*mtx_precomputed}; |
| 33 | const PrecomputedTransactionData precomputed_transaction_data{tx_precomputed}; |
| 34 | (void)SignatureHash(script_code, tx_to, in, fuzzed_data_provider.ConsumeIntegral<int>(), ConsumeMoney(fuzzed_data_provider), fuzzed_data_provider.PickValueInArray({SigVersion::BASE, SigVersion::WITNESS_V0}), 0, &precomputed_transaction_data); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | { |
| 40 | (void)CastToBool(ConsumeRandomLengthByteVector(fuzzed_data_provider)); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** Differential fuzzing for SignatureHash with and without cache. */ |
| 45 |
nothing calls this directly
no test coverage detected