Skip to content

Commit

Permalink
test: make sure we now refuse to parse some malicious scripts
Browse files Browse the repository at this point in the history
As reported in sipa#12 and
sipa#13 these two scripts
previously caused an out of bounds read and an assertion failure later
on. Make sure they now don't get parsed at all anymore.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
  • Loading branch information
darosior committed Aug 1, 2021
1 parent f3a0382 commit e74c7b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bitcoin/test/miniscript_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,9 @@ BOOST_AUTO_TEST_CASE(fixed_tests)
Test("thresh(1,c:pk_k(03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65),altv:after(1000000000),altv:after(100))", "2103d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65ac6b6300670400ca9a3bb16951686c936b6300670164b16951686c935187", TESTMODE_VALID, 18, 3);
Test("thresh(2,c:pk_k(03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65),ac:pk_k(03fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556),altv:after(1000000000),altv:after(100))", "2103d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65ac6b2103fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556ac6c936b6300670400ca9a3bb16951686c936b6300670164b16951686c935287", TESTMODE_VALID | TESTMODE_NONMAL | TESTMODE_TIMELOCKMIX, 22, 4);

assert(!miniscript::FromScript(CScript() << OP_0 << OP_0 << OP_EQUAL, CONVERTER));
assert(!miniscript::FromScript(CScript() << OP_0 << OP_2 << OP_EQUAL, CONVERTER));

g_testdata.reset();
}

Expand Down

0 comments on commit e74c7b8

Please sign in to comment.