Workaround overflow bug in poc5

This commit is contained in:
nicksavers 2014-08-24 14:28:15 +02:00
parent 2b74aca6a9
commit a203c3a1c6
1 changed files with 4 additions and 3 deletions

View File

@ -144,9 +144,10 @@ public class VM {
if(callGas.compareTo(program.getGas().value()) == 1) {
throw program.new OutOfGasException();
}
BigInteger x = stack.get(stack.size()-6).value().add(stack.get(stack.size()-7).value());
BigInteger y = stack.get(stack.size()-4).value().add(stack.get(stack.size()-5).value());
newMemSize = x.max(y);
// Casting to long (causing overflow) as workaround for PoC5 - should be removed for PoC6
long x = stack.get(stack.size()-6).value().add(stack.get(stack.size()-7).value()).longValue();
long y = stack.get(stack.size()-4).value().add(stack.get(stack.size()-5).value()).longValue();
newMemSize = BigInteger.valueOf(Math.max(x, y));
break;
case CREATE:
program.spendGas(GasCost.CREATE, op.name());