Ensure execution state stack is empty at the start
We had a single `true` on the execution state stack, which would allow scripts to have one more OP_ENDIF than they are allowed.
This commit is contained in:
parent
340b569c73
commit
d880bd1ccc
|
@ -1690,7 +1690,7 @@ impl Script {
|
||||||
let secp = Secp256k1::new();
|
let secp = Secp256k1::new();
|
||||||
|
|
||||||
let mut codeseparator_index = 0u;
|
let mut codeseparator_index = 0u;
|
||||||
let mut exec_stack = vec![true];
|
let mut exec_stack = vec![];
|
||||||
let mut alt_stack = vec![];
|
let mut alt_stack = vec![];
|
||||||
|
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
|
@ -2051,7 +2051,7 @@ impl Script {
|
||||||
fn recurse<'a>(script: &'a [u8],
|
fn recurse<'a>(script: &'a [u8],
|
||||||
mut stack: AbstractStack,
|
mut stack: AbstractStack,
|
||||||
depth: uint) -> Result<Vec<AbstractStackElem>, ScriptError> {
|
depth: uint) -> Result<Vec<AbstractStackElem>, ScriptError> {
|
||||||
let mut exec_stack = vec![true];
|
let mut exec_stack = vec![];
|
||||||
|
|
||||||
// Avoid doing more than 64k forks
|
// Avoid doing more than 64k forks
|
||||||
if depth > 16 { return Err(InterpreterStackOverflow); }
|
if depth > 16 { return Err(InterpreterStackOverflow); }
|
||||||
|
|
Loading…
Reference in New Issue