aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-02-22 20:28:50 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-02-22 20:28:50 +0800
commitdd086791acf477da7641c168f82de70ed0b2dca6 (patch)
tree3550bb51e3764d5fc0bf2faa8485e68bd08d92d2 /vm
parenteec4345a7c23e137f3cc332b7367b8046d19819b (diff)
parentfd3793b8cf04e2ca78b9c0a01844a09aa25b91e9 (diff)
downloadgo-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar.gz
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar.bz2
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar.lz
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar.xz
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.tar.zst
go-tangerine-dd086791acf477da7641c168f82de70ed0b2dca6.zip
Merge pull request #360 from Gustav-Simonsson/add_stack_size_checks
Correct stack size validation for MUL, CALLDATACOPY, EXTCODESIZE, BLOCKH...
Diffstat (limited to 'vm')
-rw-r--r--vm/vm.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/vm/vm.go b/vm/vm.go
index b20d7b603..f9efeed96 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -779,9 +779,9 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// Stack Check, memory resize & gas phase
switch op {
// Stack checks only
- case ISZERO, CALLDATALOAD, POP, JUMP, NOT: // 1
+ case ISZERO, CALLDATALOAD, POP, JUMP, NOT, EXTCODESIZE, BLOCKHASH: // 1
stack.require(1)
- case JUMPI, ADD, SUB, DIV, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2
+ case JUMPI, ADD, SUB, DIV, MUL, SDIV, MOD, SMOD, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SIGNEXTEND: // 2
stack.require(2)
case ADDMOD, MULMOD: // 3
stack.require(3)
@@ -859,7 +859,7 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-2])
additionalGas.Set(stack.data[stack.Len()-2])
case CALLDATACOPY:
- stack.require(2)
+ stack.require(3)
newMemSize = calcMemSize(stack.Peek(), stack.data[stack.Len()-3])
additionalGas.Set(stack.data[stack.Len()-3])