{ "subject": "Re: overflow bug SERIOUS", "content": { "format": "html", "body": "<div class=\"post\">Here's the preliminary change.&nbsp; Look right?&nbsp; I have more changes to make, this isn't all of it.&nbsp; Will SVN shortly.<br/><br/><div class=\"codeheader\">Code:</div><div class=\"code\">&nbsp; &nbsp; bool CheckTransaction() const<br/>&nbsp; &nbsp; {<br/>&nbsp; &nbsp; &nbsp; &nbsp; // Basic checks that don't depend on any context<br/>&nbsp; &nbsp; &nbsp; &nbsp; if (vin.empty() || vout.empty())<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : vin or vout empty\");<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; // Check for negative and overflow values<br/>&nbsp; &nbsp; &nbsp; &nbsp; int64 nTotal = 0;<br/>&nbsp; &nbsp; &nbsp; &nbsp; foreach(const CTxOut&amp; txout, vout)<br/>&nbsp; &nbsp; &nbsp; &nbsp; {<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (txout.nValue &lt; 0)<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : txout.nValue negative\");<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (txout.nValue &gt; 21000000 * COIN)<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : txout.nValue too high\");<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nTotal += txout.nValue;<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (nTotal &gt; 21000000 * COIN)<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : txout total too high\");<br/>&nbsp; &nbsp; &nbsp; &nbsp; }<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; if (IsCoinBase())<br/>&nbsp; &nbsp; &nbsp; &nbsp; {<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (vin[0].scriptSig.size() &lt; 2 || vin[0].scriptSig.size() &gt; 100)<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : coinbase script size\");<br/>&nbsp; &nbsp; &nbsp; &nbsp; }<br/>&nbsp; &nbsp; &nbsp; &nbsp; else<br/>&nbsp; &nbsp; &nbsp; &nbsp; {<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach(const CTxIn&amp; txin, vin)<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (txin.prevout.IsNull())<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return error(\"CTransaction::CheckTransaction() : prevout is null\");<br/>&nbsp; &nbsp; &nbsp; &nbsp; }<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; return true;<br/>&nbsp; &nbsp; }<br/></div><br/>Don't sticky the topic, nobody looks up there.&nbsp; 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" }
Inscription number 18,209,994
Genesis block 799,367
File type json
File size 3.86 KB
Creation date