mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
triedb/pathdb: use math.MaxUint32
This commit is contained in:
parent
26aa505581
commit
9ab465ffc2
1 changed files with 2 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"iter"
|
"iter"
|
||||||
"maps"
|
"maps"
|
||||||
|
"math"
|
||||||
"slices"
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -403,8 +404,7 @@ func decodeSingle(keySection []byte, onValue func([]byte, int, int) error) ([]st
|
||||||
keyOff += nn
|
keyOff += nn
|
||||||
|
|
||||||
// Validate that the values can fit in an int to prevent overflow on 32-bit systems
|
// Validate that the values can fit in an int to prevent overflow on 32-bit systems
|
||||||
const maxInt = int(^uint(0) >> 1)
|
if nShared > uint64(math.MaxUint32) || nUnshared > uint64(math.MaxUint32) || nValue > uint64(math.MaxUint32) {
|
||||||
if nShared > uint64(maxInt) || nUnshared > uint64(maxInt) || nValue > uint64(maxInt) {
|
|
||||||
return nil, errors.New("key size too large")
|
return nil, errors.New("key size too large")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue