aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-27 00:45:09 +0800
committerobscuren <geffobscura@gmail.com>2015-03-27 00:45:09 +0800
commitc32bca45ad753da69a5530a1ee96ff069e937fc2 (patch)
tree61b78bbbc0eaa81322b7e6b21dc70bc5b21d7dd2 /core
parentd36501a6e54e1c794af0c7109e937f7f7c74de79 (diff)
downloaddexon-c32bca45ad753da69a5530a1ee96ff069e937fc2.tar.gz
dexon-c32bca45ad753da69a5530a1ee96ff069e937fc2.tar.zst
dexon-c32bca45ad753da69a5530a1ee96ff069e937fc2.zip
Stack limit
Diffstat (limited to 'core')
-rw-r--r--core/vm/stack.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/vm/stack.go b/core/vm/stack.go
index c5c2774db..1e093476b 100644
--- a/core/vm/stack.go
+++ b/core/vm/stack.go
@@ -5,6 +5,8 @@ import (
"math/big"
)
+const maxStack = 1024
+
func newStack() *stack {
return &stack{}
}
@@ -15,6 +17,10 @@ type stack struct {
}
func (st *stack) push(d *big.Int) {
+ if len(st.data) == maxStack {
+ panic(fmt.Sprintf("stack limit reached (%d)", maxStack))
+ }
+
stackItem := new(big.Int).Set(d)
if len(st.data) > st.ptr {
st.data[st.ptr] = stackItem