clone memory in ScopeContext.MemoryData

This commit is contained in:
lmittmann 2024-07-15 16:32:52 +02:00
parent b21288d229
commit c59e9e5e6b

View file

@ -18,6 +18,7 @@ package vm
import (
"fmt"
"slices"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
@ -50,7 +51,7 @@ func (ctx *ScopeContext) MemoryData() []byte {
if ctx.Memory == nil {
return nil
}
return ctx.Memory.Data()
return slices.Clone(ctx.Memory.Data())
}
// StackData returns the stack data. Callers must not modify the contents