aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/closure.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/closure.go')
-rw-r--r--ethchain/closure.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/ethchain/closure.go b/ethchain/closure.go
index d1fac0f43..8e57a0d03 100644
--- a/ethchain/closure.go
+++ b/ethchain/closure.go
@@ -52,6 +52,10 @@ func (c *Closure) Get(x *big.Int) *ethutil.Value {
}
func (c *Closure) Gets(x, y *big.Int) *ethutil.Value {
+ if x.Int64() > int64(len(c.Script)) || y.Int64() > int64(len(c.Script)) {
+ return ethutil.NewValue(0)
+ }
+
partial := c.Script[x.Int64() : x.Int64()+y.Int64()]
return ethutil.NewValue(partial)