From 8c4e8e2d2a63ef019048bd988a2016948605920b Mon Sep 17 00:00:00 2001 From: iTanken <23544702+iTanken@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:05:16 +0800 Subject: [PATCH] fix: int type variable defaultMaxSize overflows in 32-bit environment (#7439) Refs: #7435 --- internal/stmt_store/stmt_store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/stmt_store/stmt_store.go b/internal/stmt_store/stmt_store.go index 7068419d..a82b2cf5 100644 --- a/internal/stmt_store/stmt_store.go +++ b/internal/stmt_store/stmt_store.go @@ -3,6 +3,7 @@ package stmt_store import ( "context" "database/sql" + "math" "sync" "time" @@ -73,7 +74,7 @@ type Store interface { // the cache can theoretically store as many elements as possible. // (1 << 63) - 1 is the maximum value that an int64 type can represent. const ( - defaultMaxSize = (1 << 63) - 1 + defaultMaxSize = math.MaxInt // defaultTTL defines the default time-to-live (TTL) for each cache entry. // When the TTL for cache entries is not specified, each cache entry will expire after 24 hours. defaultTTL = time.Hour * 24