mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/tracers: handle invalid mem access better
This commit is contained in:
parent
191364c350
commit
2b7b8c6ef5
1 changed files with 7 additions and 0 deletions
|
|
@ -93,6 +93,13 @@ 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 nil
|
||||
}
|
||||
if end < begin || begin < 0 {
|
||||
log.Warn("Tracer accessed memory incorrectly", "offset", begin, "size", end-begin)
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue