From cfeee2f6fc46a766eead090c9855cb7e8a511741 Mon Sep 17 00:00:00 2001 From: iPLAY888 <133153661+letmehateu@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:51:47 +0300 Subject: [PATCH] Update passphrase.go --- accounts/keystore/passphrase.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accounts/keystore/passphrase.go b/accounts/keystore/passphrase.go index 36c3d0aabc..4a49b41eed 100644 --- a/accounts/keystore/passphrase.go +++ b/accounts/keystore/passphrase.go @@ -34,6 +34,7 @@ import ( "encoding/json" "fmt" "io" + "math" "os" "path/filepath" @@ -385,6 +386,9 @@ func ensureInt(x interface{}) (int, error) { case int: return v, nil case float64: + if math.IsNaN(v) || math.IsInf(v, 0) || v != math.Trunc(v) || v < 0 || v > math.MaxInt32 { + return 0, fmt.Errorf("invalid KDF parameter: %v", v) + } return int(v), nil default: return 0, fmt.Errorf("invalid KDF parameter: expected number, got %T", x)