diff options
| author | Jeff Garzik <[email protected]> | 2012-04-22 13:44:12 -0400 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2012-04-23 14:14:36 -0400 |
| commit | c0a0a93d02251390b482d4a147531989641c5a98 (patch) | |
| tree | 2d67d65c765458e8f2425b4d54d8b46daa56b77d /src/main.cpp | |
| parent | SigOp and orphan-tx constants and counts are always unsigned. (diff) | |
| download | discoin-c0a0a93d02251390b482d4a147531989641c5a98.tar.xz discoin-c0a0a93d02251390b482d4a147531989641c5a98.zip | |
Test ScriptSigArgsExpected() for error, before accumulating return value
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7edd87a1e..2480d2659 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -297,6 +297,8 @@ bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const if (!Solver(prevScript, whichType, vSolutions)) return false; int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions); + if (nArgsExpected < 0) + return false; // Transactions with extra stuff in their scriptSigs are // non-standard. Note that this EvalScript() call will @@ -318,10 +320,15 @@ bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const return false; if (whichType2 == TX_SCRIPTHASH) return false; - nArgsExpected += ScriptSigArgsExpected(whichType2, vSolutions2); + + int tmpExpected; + tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2); + if (tmpExpected < 0) + return false; + nArgsExpected += tmpExpected; } - if (stack.size() != nArgsExpected) + if (stack.size() != (unsigned int)nArgsExpected) return false; } |