mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/storage: Catch c<0 for varint read overflows
This commit is contained in:
parent
08fc950a2e
commit
d10516b47e
1 changed files with 2 additions and 2 deletions
|
|
@ -861,14 +861,14 @@ func isMultihash(data []byte) int {
|
|||
cursor := 0
|
||||
hashtype, c := binary.Uvarint(data)
|
||||
log.Trace("ismultihash", "hashtype", hashtype, "c", c)
|
||||
if c == 0 {
|
||||
if c <= 0 {
|
||||
log.Debug("Corrupt multihash data, hashtype is unreadable")
|
||||
return 0
|
||||
}
|
||||
cursor += c
|
||||
hashlength, c := binary.Uvarint(data[cursor:])
|
||||
log.Trace("ismultihash", "hashlength", hashlength, "c", c)
|
||||
if c == 0 {
|
||||
if c <= 0 {
|
||||
log.Debug("Corrupt multihash data, hashlength is unreadable")
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue