From f37fe6750f98c551091c774d08ec9bcd58852663 Mon Sep 17 00:00:00 2001 From: Delweng Date: Mon, 21 Jul 2025 16:30:43 +0800 Subject: [PATCH] triedb/pathdb: fix incorrect address length in history searching (#32248) We should use account length to check address, else OOB maybe occured Signed-off-by: jsvisa --- triedb/pathdb/history_reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/triedb/pathdb/history_reader.go b/triedb/pathdb/history_reader.go index 8f72d4053e..d0ecdf035f 100644 --- a/triedb/pathdb/history_reader.go +++ b/triedb/pathdb/history_reader.go @@ -210,7 +210,7 @@ func (r *historyReader) readAccountMetadata(address common.Address, historyID ui n := len(blob) / accountIndexSize pos := sort.Search(n, func(i int) bool { - h := blob[accountIndexSize*i : accountIndexSize*i+common.HashLength] + h := blob[accountIndexSize*i : accountIndexSize*i+common.AddressLength] return bytes.Compare(h, address.Bytes()) >= 0 }) if pos == n {