aboutsummaryrefslogtreecommitdiff
path: root/src/compressor.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-04-24 16:21:44 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-04-25 14:42:07 +0200
commit5d0434d13d0145a110c0c93e59edfd7d062f8531 (patch)
tree7a6629f4f661d2b52b8d5b2304cf42e673caf7e8 /src/compressor.h
parent4bf631e5e48cd4c14c825cdaf7a1bee81e15493d (diff)
downloadbitcoin-5d0434d13d0145a110c0c93e59edfd7d062f8531.tar.xz
Fix OOM bug: UTXO entries with invalid script length
Diffstat (limited to 'src/compressor.h')
-rw-r--r--src/compressor.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compressor.h b/src/compressor.h
index 4a72090830..fa702f0dfa 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));
+ }
}
};