proposed fix for issue 242
This commit is contained in:
parent
b38c393fbd
commit
a754260423
2 changed files with 6 additions and 2 deletions
|
@ -62,6 +62,7 @@ bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector
|
||||||
|
|
||||||
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams, CScript::const_iterator& pc)
|
bool DecodeClaimScript(const CScript& scriptIn, int& op, std::vector<std::vector<unsigned char> >& vvchParams, CScript::const_iterator& pc)
|
||||||
{
|
{
|
||||||
|
op = -1;
|
||||||
opcodetype opcode;
|
opcodetype opcode;
|
||||||
if (!scriptIn.GetOp(pc, opcode))
|
if (!scriptIn.GetOp(pc, opcode))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1493,6 +1493,11 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C
|
||||||
|
|
||||||
// scriptSig and scriptPubKey must be evaluated sequentially on the same stack
|
// scriptSig and scriptPubKey must be evaluated sequentially on the same stack
|
||||||
// rather than being simply concatenated (see CVE-2010-5141)
|
// rather than being simply concatenated (see CVE-2010-5141)
|
||||||
|
int claimOp;
|
||||||
|
const CScript& strippedScriptPubKey = StripClaimScriptPrefix(scriptPubKey, claimOp);
|
||||||
|
if (claimOp >= 0) // lbryum used to violate this rule with an off-by-1 at len == 255 (and its not very important)
|
||||||
|
flags &= ~SCRIPT_VERIFY_MINIMALDATA;
|
||||||
|
|
||||||
std::vector<std::vector<unsigned char> > stack, stackCopy;
|
std::vector<std::vector<unsigned char> > stack, stackCopy;
|
||||||
if (!EvalScript(stack, scriptSig, flags, checker, SigVersion::BASE, serror))
|
if (!EvalScript(stack, scriptSig, flags, checker, SigVersion::BASE, serror))
|
||||||
// serror is set
|
// serror is set
|
||||||
|
@ -1509,8 +1514,6 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C
|
||||||
|
|
||||||
// Bare witness programs
|
// Bare witness programs
|
||||||
|
|
||||||
const CScript& strippedScriptPubKey = StripClaimScriptPrefix(scriptPubKey);
|
|
||||||
|
|
||||||
int witnessversion;
|
int witnessversion;
|
||||||
std::vector<unsigned char> witnessprogram;
|
std::vector<unsigned char> witnessprogram;
|
||||||
if (flags & SCRIPT_VERIFY_WITNESS) {
|
if (flags & SCRIPT_VERIFY_WITNESS) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue