Skip to content

Commit c1917c3

Browse files
committed
miniscript: check thresh bounds when parsing a script
The check was dropped in 4085ffc Signed-off-by: Antoine Poinsot <[email protected]>
1 parent 200f5ef commit c1917c3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

bitcoin/script/miniscript.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ inline NodeRef<Key> DecodeScript(I& in, I last, const Ctx& ctx) {
13381338
break;
13391339
}
13401340
case DecodeContext::THRESH_E: {
1341+
if (k < 1 || k > n) return {};
13411342
std::vector<NodeRef<Key>> subs;
13421343
for (int i = 0; i < n; ++i) {
13431344
NodeRef<Key> sub = std::move(constructed.back());

0 commit comments

Comments
 (0)