Some possibly invalid input miniscripts may cause the miniscript evaluator to misbehave:
- when compiling in debug mode, at least we get an assertion failure (the program will crash and exit).
- when compiling in the release, that function may return some random std::string reference, causing UB.
See the lamda fucntion starting on src/script/miniscript.h:571.
Detected by gcc during compilation with -Wreturn-type. But as it is in a lambda, itself hidden in a template, it was hard to see at the location indicated (which is just the 1st line of the lambda missing some valid return).
So the final assert(false);
is insufficient, it should at least be an exception that can be caught, or some valid string such as "" (depending on the expected semantics).