From e6578e7fa7385dde7a0de9c2e87d8c0afa176314 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 01:56:47 +0200 Subject: [PATCH 1/7] remove unused typedef in serialize.h --- src/serialize.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 302766062ab..959a3a694ba 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1244,8 +1244,6 @@ public: int nType; int nVersion; - typedef FILE element_type; - CAutoFile(FILE* filenew=NULL, int nTypeIn=SER_DISK, int nVersionIn=VERSION) { file = filenew; From 8edec3f9d6e91aa1a3f2cb9042d1137fce591142 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 18:45:10 +0200 Subject: [PATCH 2/7] fix DEPENDPATH in the project file, as json has no include sub-dir and src was in twice --- bitcoin-qt.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 922f42ed766..56ecbfd984a 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -76,7 +76,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wno-strict-aliasing -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wno-char-subscripts -Wno-unused-value -Wno-sequence-point -Wno-parentheses -Wno-unknown-pragmas -Wno-switch # Input -DEPENDPATH += src/qt src src json/include +DEPENDPATH += src src/json src/qt HEADERS += src/qt/bitcoingui.h \ src/qt/transactiontablemodel.h \ src/qt/addresstablemodel.h \ From 48984829151d76fefb62029e500145d7e4f19a8d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 01:46:03 +0200 Subject: [PATCH 3/7] fix compiler warning "suggest parentheses around assignment used as truth value [-Wparentheses]" in util.cpp --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index a45d19156f1..766c3ab4477 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -236,7 +236,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...) *pend = '\0'; char* p1 = pszBuffer; char* p2; - while (p2 = strchr(p1, '\n')) + while ((p2 = strchr(p1, '\n'))) { p2++; char c = *p2; From 6789e99e4f70b9e779598f1a31552a87b5bd9360 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 22:26:33 +0200 Subject: [PATCH 4/7] add bitcoin-qt.rc to OTHER_FILES (shown in Qt Creator) --- bitcoin-qt.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 56ecbfd984a..8af8895db10 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -219,7 +219,7 @@ PRE_TARGETDEPS += compiler_TSQM_make_all # "Other files" to show in Qt Creator OTHER_FILES += \ - doc/*.rst doc/*.txt doc/README README.md + doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc # platform specific defaults, if not overridden on command line isEmpty(BOOST_LIB_SUFFIX) { From cae1a682678e94015ff89be2c6fa6484c8ef6fbe Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 3 May 2012 11:30:52 +0200 Subject: [PATCH 5/7] remove obsolete BackupWallet() entry in wallet.h --- src/wallet.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wallet.h b/src/wallet.h index e0f39b4170a..ea7b279268d 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -166,7 +166,6 @@ public: } int LoadWallet(bool& fFirstRunRet); -// bool BackupWallet(const std::string& strDest); bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); From ad5a4c7c471912aa0bef52c33a1abfb01fe6d89d Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 29 Apr 2012 20:56:55 -0400 Subject: [PATCH 6/7] Check earlier for blocks with duplicate transactions. Fixes #1167 --- src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index e6f94210b98..e8cbc01c7f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1472,6 +1472,16 @@ bool CBlock::CheckBlock() const if (!tx.CheckTransaction()) return error("CheckBlock() : CheckTransaction failed"); + // Check for duplicate txids. This is caught by ConnectInputs(), + // but catching it earlier avoids a potential DoS attack: + set uniqueTx; + BOOST_FOREACH(const CTransaction& tx, vtx) + { + uniqueTx.insert(tx.GetHash()); + } + if (uniqueTx.size() != vtx.size()) + return error("CheckBlock() : duplicate transaction"); + // Check that it's not full of nonstandard transactions if (GetSigOpCount() > MAX_BLOCK_SIGOPS) return error("CheckBlock() : out-of-bounds SigOpCount"); From 6a89317f621692e7d5c0c67b3a1440bf1b52b328 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 29 Apr 2012 20:56:55 -0400 Subject: [PATCH 7/7] Check earlier for blocks with duplicate transactions. Fixes #1167 --- src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index d72a131a5f5..5f98d49530e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1492,6 +1492,16 @@ bool CBlock::CheckBlock() const if (!tx.CheckTransaction()) return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed")); + // Check for duplicate txids. This is caught by ConnectInputs(), + // but catching it earlier avoids a potential DoS attack: + set uniqueTx; + BOOST_FOREACH(const CTransaction& tx, vtx) + { + uniqueTx.insert(tx.GetHash()); + } + if (uniqueTx.size() != vtx.size()) + return DoS(100, error("CheckBlock() : duplicate transaction")); + // Check that it's not full of nonstandard transactions if (GetSigOpCount() > MAX_BLOCK_SIGOPS) return DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"));