diff options
| author | Pieter Wuille <[email protected]> | 2016-04-24 16:21:44 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-04-25 14:42:07 +0200 |
| commit | 5d0434d13d0145a110c0c93e59edfd7d062f8531 (patch) | |
| tree | 7a6629f4f661d2b52b8d5b2304cf42e673caf7e8 /src/compressor.h | |
| parent | CDataStream::ignore Throw exception instead of assert on negative nSize. (diff) | |
| download | discoin-5d0434d13d0145a110c0c93e59edfd7d062f8531.tar.xz discoin-5d0434d13d0145a110c0c93e59edfd7d062f8531.zip | |
Fix OOM bug: UTXO entries with invalid script length
Diffstat (limited to 'src/compressor.h')
| -rw-r--r-- | src/compressor.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compressor.h b/src/compressor.h index 4a7209083..fa702f0df 100644 --- a/src/compressor.h +++ b/src/compressor.h @@ -86,8 +86,14 @@ public: return; } nSize -= nSpecialScripts; - script.resize(nSize); - s >> REF(CFlatData(script)); + if (nSize > MAX_SCRIPT_SIZE) { + // Overly long script, replace with a short invalid one + script << OP_RETURN; + s.ignore(nSize); + } else { + script.resize(nSize); + s >> REF(CFlatData(script)); + } } }; |