From d880bd1ccc81484ec400643b52ac53e3e8de684f Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Sun, 31 Aug 2014 16:23:47 -0700 Subject: [PATCH] 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. --- src/blockdata/script.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 8b5da4e..5632bd4 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -1690,7 +1690,7 @@ impl Script { let secp = Secp256k1::new(); let mut codeseparator_index = 0u; - let mut exec_stack = vec![true]; + let mut exec_stack = vec![]; let mut alt_stack = vec![]; let mut index = 0; @@ -2051,7 +2051,7 @@ impl Script { fn recurse<'a>(script: &'a [u8], mut stack: AbstractStack, depth: uint) -> Result, ScriptError> { - let mut exec_stack = vec![true]; + let mut exec_stack = vec![]; // Avoid doing more than 64k forks if depth > 16 { return Err(InterpreterStackOverflow); }