Fuzz tests that test parsing from a script, and roundtripping via script. */
| 1253 | |
| 1254 | /* Fuzz tests that test parsing from a script, and roundtripping via script. */ |
| 1255 | FUZZ_TARGET(miniscript_script) |
| 1256 | { |
| 1257 | FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); |
| 1258 | const std::optional<CScript> script = ConsumeDeserializable<CScript>(fuzzed_data_provider); |
| 1259 | if (!script) return; |
| 1260 | |
| 1261 | const ScriptParserContext script_parser_ctx{(MsCtx)fuzzed_data_provider.ConsumeBool()}; |
| 1262 | const auto ms = miniscript::FromScript(*script, script_parser_ctx); |
| 1263 | if (!ms) return; |
| 1264 | |
| 1265 | assert(ms->ToScript(script_parser_ctx) == *script); |
| 1266 | } |
no test coverage detected