fix checkmultisig for nonstandard scripts.

This commit is contained in:
Christopher Jeffrey 2016-02-18 22:53:13 -08:00
parent 8b17c09116
commit 29576c7bcc

View File

@ -918,7 +918,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
} }
case 'checkmultisigverify': case 'checkmultisigverify':
case 'checkmultisig': { case 'checkmultisig': {
if (!tx || stack.length < 3) if (!tx || stack.length < 4)
return false; return false;
n = script.num(stack.pop(), true); n = script.num(stack.pop(), true);
@ -944,7 +944,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (!(m >= 1 && m <= n)) if (!(m >= 1 && m <= n))
return false; return false;
if (stack.length < m + 1) if (stack.length < m)
return false; return false;
subscript = script.getSubscript(data, lastSep); subscript = script.getSubscript(data, lastSep);
@ -973,12 +973,12 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
succ++; succ++;
} }
if (stack.length < 1)
return false;
val = stack.pop();
if (flags & constants.flags.VERIFY_NULLDUMMY) { if (flags & constants.flags.VERIFY_NULLDUMMY) {
if (stack.length < 1)
return false;
val = stack.pop();
if (!script.isDummy(val)) if (!script.isDummy(val))
return false; return false;
} }
@ -1009,8 +1009,10 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (!Array.isArray(locktime)) if (!Array.isArray(locktime))
return false; return false;
if (locktime.length > 6) if (locktime.length > 6) {
utils.debug('Warning: locktime is over 53 bits.');
return false; return false;
}
locktime = script.num(locktime, true); locktime = script.num(locktime, true);
@ -1028,7 +1030,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (locktime > tx.locktime) if (locktime > tx.locktime)
return false; return false;
if (!tx.inputs[index] || tx.inputs[index].sequence === 0xffffffff) if (tx.inputs[index].sequence === 0xffffffff)
return false; return false;
break; break;