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 <delweng@gmail.com>
This commit is contained in:
Delweng 2025-07-21 16:30:43 +08:00 committed by GitHub
parent f17df6db91
commit f37fe6750f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {