{
"subject": "Re: overflow bug SERIOUS",
"content": {
"format": "html",
"body": "<div class=\"post\">Here's the preliminary change. Look right? I have more changes to make, this isn't all of it. Will SVN shortly.<br/><br/><div class=\"codeheader\">Code:</div><div class=\"code\"> bool CheckTransaction() const<br/> {<br/> // Basic checks that don't depend on any context<br/> if (vin.empty() || vout.empty())<br/> return error(\"CTransaction::CheckTransaction() : vin or vout empty\");<br/><br/> // Check for negative and overflow values<br/> int64 nTotal = 0;<br/> foreach(const CTxOut& txout, vout)<br/> {<br/> if (txout.nValue < 0)<br/> return error(\"CTransaction::CheckTransaction() : txout.nValue negative\");<br/> if (txout.nValue > 21000000 * COIN)<br/> return error(\"CTransaction::CheckTransaction() : txout.nValue too high\");<br/> nTotal += txout.nValue;<br/> if (nTotal > 21000000 * COIN)<br/> return error(\"CTransaction::CheckTransaction() : txout total too high\");<br/> }<br/><br/> if (IsCoinBase())<br/> {<br/> if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)<br/> return error(\"CTransaction::CheckTransaction() : coinbase script size\");<br/> }<br/> else<br/> {<br/> foreach(const CTxIn& txin, vin)<br/> if (txin.prevout.IsNull())<br/> return error(\"CTransaction::CheckTransaction() : prevout is null\");<br/> }<br/><br/> return true;<br/> }<br/></div><br/>Don't sticky the topic, nobody looks up there. There'll be enough posts to bump.</div>"
},
"source": {
"name": "Bitcoin Forum",
"url": "https://bitcointalk.org/index.php?topic=823.msg9530#msg9530"
},
"date": "2010-08-15T20:59:09Z"
}