From c59e9e5e6b28240093583a9a9f16bc060c8b1f7c Mon Sep 17 00:00:00 2001 From: lmittmann Date: Mon, 15 Jul 2024 16:32:52 +0200 Subject: [PATCH] clone memory in `ScopeContext.MemoryData` --- core/vm/interpreter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 6e7d28a0ce..3bc38d9ade 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -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