diff --git a/eth/tracers/internal/util.go b/eth/tracers/internal/util.go index 88a9f5db44..cd22e2158b 100644 --- a/eth/tracers/internal/util.go +++ b/eth/tracers/internal/util.go @@ -53,7 +53,8 @@ func memoryCopy(m []byte, offset, size int64) (cpy []byte) { return nil } - if len(m) > int(offset) { + // Check that we have enough data in the slice to safely copy the requested range + if len(m) > int(offset) && int(offset+size) <= len(m) { cpy = make([]byte, size) copy(cpy, m[offset:offset+size])