mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-11 10:36:37 +00:00
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:
parent
f17df6db91
commit
f37fe6750f
1 changed files with 1 additions and 1 deletions
|
|
@ -210,7 +210,7 @@ func (r *historyReader) readAccountMetadata(address common.Address, historyID ui
|
||||||
n := len(blob) / accountIndexSize
|
n := len(blob) / accountIndexSize
|
||||||
|
|
||||||
pos := sort.Search(n, func(i int) bool {
|
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
|
return bytes.Compare(h, address.Bytes()) >= 0
|
||||||
})
|
})
|
||||||
if pos == n {
|
if pos == n {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue