aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 3e7d2b9ecc..0977b32400 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1006,6 +1006,14 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
mapTestPool[prevout.hash] = txindex;
nValueIn += txPrev.vout[prevout.n].nValue;
+
+ // Check for negative or overflow input values
+ if (txPrev.vout[prevout.n].nValue < 0)
+ return error("ConnectInputs() : txin.nValue negative");
+ if (txPrev.vout[prevout.n].nValue > MAX_MONEY)
+ return error("ConnectInputs() : txin.nValue too high");
+ if (nValueIn > MAX_MONEY)
+ return error("ConnectInputs() : txin total too high");
}
// Tally transaction fees