Skip to content

Commit f37fe67

Browse files
authored
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 <[email protected]>
1 parent f17df6d commit f37fe67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

triedb/pathdb/history_reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (r *historyReader) readAccountMetadata(address common.Address, historyID ui
210210
n := len(blob) / accountIndexSize
211211

212212
pos := sort.Search(n, func(i int) bool {
213-
h := blob[accountIndexSize*i : accountIndexSize*i+common.HashLength]
213+
h := blob[accountIndexSize*i : accountIndexSize*i+common.AddressLength]
214214
return bytes.Compare(h, address.Bytes()) >= 0
215215
})
216216
if pos == n {

0 commit comments

Comments
 (0)