Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,000 Lines • ▼ Show 20 Lines | try { | ||||
// stack depth of the dummy element | // stack depth of the dummy element | ||||
const size_t idxDummy = idxTopSig + nSigsCount; | const size_t idxDummy = idxTopSig + nSigsCount; | ||||
if (stack.size() < idxDummy) { | if (stack.size() < idxDummy) { | ||||
return set_error( | return set_error( | ||||
serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | ||||
} | } | ||||
// A bug causes CHECKMULTISIG to consume one extra | |||||
// argument whose contents were not checked in any way. | |||||
// | |||||
// Unfortunately this is a potential source of | |||||
// mutability, so optionally verify it is exactly equal | |||||
// to zero. | |||||
if ((flags & SCRIPT_VERIFY_NULLDUMMY) && | |||||
stacktop(-idxDummy).size()) { | |||||
return set_error(serror, SCRIPT_ERR_SIG_NULLDUMMY); | |||||
} | |||||
// Subset of script starting at the most recent | // Subset of script starting at the most recent | ||||
// codeseparator | // codeseparator | ||||
CScript scriptCode(pbegincodehash, pend); | CScript scriptCode(pbegincodehash, pend); | ||||
// Remove signature for pre-fork scripts | // Remove signature for pre-fork scripts | ||||
for (int k = 0; k < nSigsCount; k++) { | for (int k = 0; k < nSigsCount; k++) { | ||||
valtype &vchSig = stacktop(-idxTopSig - k); | valtype &vchSig = stacktop(-idxTopSig - k); | ||||
CleanupScriptCode(scriptCode, vchSig, flags); | CleanupScriptCode(scriptCode, vchSig, flags); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | try { | ||||
SCRIPT_ERR_SIG_NULLFAIL); | SCRIPT_ERR_SIG_NULLFAIL); | ||||
} | } | ||||
if (ikey2 > 0) { | if (ikey2 > 0) { | ||||
ikey2--; | ikey2--; | ||||
} | } | ||||
popstack(stack); | popstack(stack); | ||||
} | } | ||||
// A bug causes CHECKMULTISIG to consume one extra | // pop dummy element. | ||||
// argument whose contents were not checked in any way. | |||||
// | |||||
// Unfortunately this is a potential source of | |||||
// mutability, so optionally verify it is exactly equal | |||||
// to zero prior to removing it from the stack. | |||||
if (stack.size() < 1) { | |||||
return set_error( | |||||
serror, SCRIPT_ERR_INVALID_STACK_OPERATION); | |||||
} | |||||
if ((flags & SCRIPT_VERIFY_NULLDUMMY) && | |||||
stacktop(-1).size()) { | |||||
return set_error(serror, SCRIPT_ERR_SIG_NULLDUMMY); | |||||
} | |||||
popstack(stack); | popstack(stack); | ||||
stack.push_back(fSuccess ? vchTrue : vchFalse); | stack.push_back(fSuccess ? vchTrue : vchFalse); | ||||
if (opcode == OP_CHECKMULTISIGVERIFY) { | if (opcode == OP_CHECKMULTISIGVERIFY) { | ||||
if (fSuccess) { | if (fSuccess) { | ||||
popstack(stack); | popstack(stack); | ||||
} else { | } else { | ||||
return set_error( | return set_error( | ||||
serror, SCRIPT_ERR_CHECKMULTISIGVERIFY); | serror, SCRIPT_ERR_CHECKMULTISIGVERIFY); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 578 Lines • Show Last 20 Lines |