diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-04-26 13:23:02 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-04-26 13:23:05 +0200 |
| commit | e26b62093ae21e89ed7d36a24a6b863f38ec631d (patch) | |
| tree | fd121a030bee3885043635dcf471a36bc8f1f5a6 /src/script/script.h | |
| parent | Merge #7941: Fixing comment in script_test.json test case (diff) | |
| parent | Add tests for CCoins deserialization (diff) | |
| download | discoin-e26b62093ae21e89ed7d36a24a6b863f38ec631d.tar.xz discoin-e26b62093ae21e89ed7d36a24a6b863f38ec631d.zip | |
Merge #7933: Fix OOM when deserializing UTXO entries with invalid length
1e44169 Add tests for CCoins deserialization (Pieter Wuille)
5d0434d Fix OOM bug: UTXO entries with invalid script length (Pieter Wuille)
4bf631e CDataStream::ignore Throw exception instead of assert on negative nSize. (Patrick Strateman)
4f87af6 Treat overly long scriptPubKeys as unspendable (Pieter Wuille)
f8e6fb1 Introduce constant for maximum CScript length (Pieter Wuille)
Diffstat (limited to 'src/script/script.h')
| -rw-r--r-- | src/script/script.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/script.h b/src/script/script.h index d2a68a07b..2a338d6f5 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -27,6 +27,9 @@ static const int MAX_OPS_PER_SCRIPT = 201; // Maximum number of public keys per multisig static const int MAX_PUBKEYS_PER_MULTISIG = 20; +// Maximum script length in bytes +static const int MAX_SCRIPT_SIZE = 10000; + // Threshold for nLockTime: below this value it is interpreted as block number, // otherwise as UNIX timestamp. static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC @@ -621,7 +624,7 @@ public: */ bool IsUnspendable() const { - return (size() > 0 && *begin() == OP_RETURN); + return (size() > 0 && *begin() == OP_RETURN) || (size() > MAX_SCRIPT_SIZE); } void clear() |