From 50bb1e731354dc50449dc74fdd9a759fab7c6df4 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 5 Jul 2026 17:59:05 +0800 Subject: [PATCH] ethdb/memorydb: avoid corrupting prefix slice in NewIterator append(prefix, start...) can mutate the caller's prefix slice when it has spare capacity. Build the start key with string concatenation instead. --- ethdb/memorydb/memorydb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethdb/memorydb/memorydb.go b/ethdb/memorydb/memorydb.go index 29ed0aaea1..fc2a30eaa7 100644 --- a/ethdb/memorydb/memorydb.go +++ b/ethdb/memorydb/memorydb.go @@ -169,7 +169,7 @@ func (db *Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator { var ( pr = string(prefix) - st = string(append(prefix, start...)) + st = string(prefix) + string(start) keys = make([]string, 0, len(db.db)) values = make([][]byte, 0, len(db.db)) )