mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-02-27 11:10:29 +00:00
Workaround overflow bug in poc5
This commit is contained in:
parent
2b74aca6a9
commit
a203c3a1c6
@ -144,9 +144,10 @@ public class VM {
|
|||||||
if(callGas.compareTo(program.getGas().value()) == 1) {
|
if(callGas.compareTo(program.getGas().value()) == 1) {
|
||||||
throw program.new OutOfGasException();
|
throw program.new OutOfGasException();
|
||||||
}
|
}
|
||||||
BigInteger x = stack.get(stack.size()-6).value().add(stack.get(stack.size()-7).value());
|
// Casting to long (causing overflow) as workaround for PoC5 - should be removed for PoC6
|
||||||
BigInteger y = stack.get(stack.size()-4).value().add(stack.get(stack.size()-5).value());
|
long x = stack.get(stack.size()-6).value().add(stack.get(stack.size()-7).value()).longValue();
|
||||||
newMemSize = x.max(y);
|
long y = stack.get(stack.size()-4).value().add(stack.get(stack.size()-5).value()).longValue();
|
||||||
|
newMemSize = BigInteger.valueOf(Math.max(x, y));
|
||||||
break;
|
break;
|
||||||
case CREATE:
|
case CREATE:
|
||||||
program.spendGas(GasCost.CREATE, op.name());
|
program.spendGas(GasCost.CREATE, op.name());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user