Fix OOM bug: UTXO entries with invalid script length

This commit is contained in:
Pieter Wuille
2016-04-24 16:21:44 +02:00
parent 4bf631e5e4
commit 5d0434d13d
2 changed files with 22 additions and 2 deletions

View File

@@ -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));
}
}
};