Skip to content

Conversation

@sanket1729
Copy link
Member

Fixes #41 .

Adds robustness to miniscript creation from policy compiler, bitcoin script, and string.

@sanket1729 sanket1729 force-pushed the heavy_nest branch 2 times, most recently from c3172b4 to 9c388a4 Compare June 19, 2020 01:02
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

As discussed on IRC, this PR is more-or-less a stopgap before we implement a more general solution (eliminating recursion everywhere). It should prevent any Miniscript from existing, except by manual data structure construction, which is deep enough to trigger an overflow. Currently Bitcoin Script limits prevent any more deeply-nested Miniscript from being a valid Script anyway.

However, this won't be true in Taproot, and it will probably not always be true in Elements, and it certainly won't be true for the Simplicity analogue of Miniscript.

@apoelstra apoelstra merged commit 1d270ae into rust-bitcoin:master Jun 26, 2020
/// Attempt to parse a script into a Miniscript representation
pub fn parse(script: &script::Script) -> Result<Miniscript<bitcoin::PublicKey>, Error> {
// Transactions more than 100Kb are non-standard
if script.len() > 10000 {}
Copy link
Contributor

@RCasatta RCasatta Jun 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing to return Err?
Is it missing a 0 to be 100k?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reivew :) . Good catch, will fixup shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiling heavily nested policy causes "fatal runtime error: stack overflow"

3 participants