disabled opcodes fixes.
This commit is contained in:
parent
0a621238ba
commit
4960e48b48
@ -1529,33 +1529,33 @@ Script.prototype.interpret = function interpret(stack, flags, tx, index, version
|
||||
case opcodes.OP_SUBSTR: {
|
||||
if (stack.length < 3)
|
||||
throw new ScriptError('Stack too small.', op, ip);
|
||||
v1 = Script.num(stack.pop(), flags).toNumber(); // end
|
||||
v3 = Script.num(stack.pop(), flags).toNumber(); // end
|
||||
v2 = Script.num(stack.pop(), flags).toNumber(); // begin
|
||||
v3 = stack.pop(); // string
|
||||
if (v2 < 0 || v1 < v2)
|
||||
v1 = stack.pop(); // string
|
||||
if (v2 < 0 || v3 < v2)
|
||||
throw new ScriptError('String begin and end out of range.', op, ip);
|
||||
if (v2 > v3.length)
|
||||
v2 = v3.length;
|
||||
if (v1 > v3.length)
|
||||
v1 = v3.length;
|
||||
stack.push(v3.slice(v2, v1));
|
||||
if (v2 > v1.length)
|
||||
v2 = v1.length;
|
||||
if (v3 > v1.length)
|
||||
v3 = v1.length;
|
||||
stack.push(v1.slice(v2, v3));
|
||||
break;
|
||||
}
|
||||
case opcodes.OP_LEFT:
|
||||
case opcodes.OP_RIGHT: {
|
||||
if (stack.length < 2)
|
||||
throw new ScriptError('Stack too small.', op, ip);
|
||||
v1 = Script.num(stack.pop(), flags).toNumber(); // size
|
||||
v2 = stack.pop(); // string
|
||||
if (v1 < 0)
|
||||
v2 = Script.num(stack.pop(), flags).toNumber(); // size
|
||||
v1 = stack.pop(); // string
|
||||
if (v2 < 0)
|
||||
throw new ScriptError('String size is negative.', op, ip);
|
||||
if (v1 > v2.length)
|
||||
v1 = v2.length;
|
||||
if (v2 > v1.length)
|
||||
v2 = v1.length;
|
||||
if (op === opcodes.OP_LEFT)
|
||||
v2 = v2.slice(0, v1);
|
||||
v1 = v1.slice(0, v2);
|
||||
else
|
||||
v2 = v2.slice(v2.length - v1);
|
||||
stack.push(v2);
|
||||
v1 = v1.slice(v1.length - v2);
|
||||
stack.push(v1);
|
||||
break;
|
||||
}
|
||||
case opcodes.OP_INVERT: {
|
||||
@ -1563,7 +1563,7 @@ Script.prototype.interpret = function interpret(stack, flags, tx, index, version
|
||||
throw new ScriptError('Stack too small.', op, ip);
|
||||
val = utils.slice(stack.pop());
|
||||
for (i = 0; i < val.length; i++)
|
||||
val[i] = ~val[i];
|
||||
val[i] = ~val[i] & 0xff;
|
||||
stack.push(val);
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user