From 9ab465ffc2e20297fa5916fcf1f4499d961799a3 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 6 Nov 2025 18:59:29 +0800 Subject: [PATCH] triedb/pathdb: use math.MaxUint32 --- triedb/pathdb/history_trienode.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/triedb/pathdb/history_trienode.go b/triedb/pathdb/history_trienode.go index 6334633889..1004106af9 100644 --- a/triedb/pathdb/history_trienode.go +++ b/triedb/pathdb/history_trienode.go @@ -23,6 +23,7 @@ import ( "fmt" "iter" "maps" + "math" "slices" "sort" "time" @@ -403,8 +404,7 @@ func decodeSingle(keySection []byte, onValue func([]byte, int, int) error) ([]st keyOff += nn // 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(maxInt) || nUnshared > uint64(maxInt) || nValue > uint64(maxInt) { + if nShared > uint64(math.MaxUint32) || nUnshared > uint64(math.MaxUint32) || nValue > uint64(math.MaxUint32) { return nil, errors.New("key size too large") }