|
|
|
@ -93,6 +93,15 @@ type memoryWrapper struct { |
|
|
|
|
|
|
|
|
|
// slice returns the requested range of memory as a byte slice.
|
|
|
|
|
func (mw *memoryWrapper) slice(begin, end int64) []byte { |
|
|
|
|
if end == begin { |
|
|
|
|
return []byte{} |
|
|
|
|
} |
|
|
|
|
if end < begin || begin < 0 { |
|
|
|
|
// TODO(karalabe): We can't js-throw from Go inside duktape inside Go. The Go
|
|
|
|
|
// runtime goes belly up https://github.com/golang/go/issues/15639.
|
|
|
|
|
log.Warn("Tracer accessed out of bound memory", "offset", begin, "end", end) |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
if mw.memory.Len() < int(end) { |
|
|
|
|
// TODO(karalabe): We can't js-throw from Go inside duktape inside Go. The Go
|
|
|
|
|
// runtime goes belly up https://github.com/golang/go/issues/15639.
|
|
|
|
@ -104,7 +113,7 @@ func (mw *memoryWrapper) slice(begin, end int64) []byte { |
|
|
|
|
|
|
|
|
|
// getUint returns the 32 bytes at the specified address interpreted as a uint.
|
|
|
|
|
func (mw *memoryWrapper) getUint(addr int64) *big.Int { |
|
|
|
|
if mw.memory.Len() < int(addr)+32 { |
|
|
|
|
if mw.memory.Len() < int(addr)+32 || addr < 0 { |
|
|
|
|
// TODO(karalabe): We can't js-throw from Go inside duktape inside Go. The Go
|
|
|
|
|
// runtime goes belly up https://github.com/golang/go/issues/15639.
|
|
|
|
|
log.Warn("Tracer accessed out of bound memory", "available", mw.memory.Len(), "offset", addr, "size", 32) |
|
|
|
@ -147,7 +156,7 @@ type stackWrapper struct { |
|
|
|
|
|
|
|
|
|
// peek returns the nth-from-the-top element of the stack.
|
|
|
|
|
func (sw *stackWrapper) peek(idx int) *big.Int { |
|
|
|
|
if len(sw.stack.Data()) <= idx { |
|
|
|
|
if len(sw.stack.Data()) <= idx || idx < 0 { |
|
|
|
|
// TODO(karalabe): We can't js-throw from Go inside duktape inside Go. The Go
|
|
|
|
|
// runtime goes belly up https://github.com/golang/go/issues/15639.
|
|
|
|
|
log.Warn("Tracer accessed out of bound stack", "size", len(sw.stack.Data()), "index", idx) |
|
|
|
|