From c3426dbd693a0e88b418463111a4c9cf25ebfb2b Mon Sep 17 00:00:00 2001 From: mariadb-AndreyPiskunov Date: Thu, 22 Sep 2022 20:30:25 +0300 Subject: [PATCH] Explicit cast of INT_MIN/MAX to double --- utils/funcexp/func_round.cpp | 4 +++- utils/funcexp/func_truncate.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/funcexp/func_round.cpp b/utils/funcexp/func_round.cpp index 98ef7d418..9f265f961 100644 --- a/utils/funcexp/func_round.cpp +++ b/utils/funcexp/func_round.cpp @@ -498,7 +498,9 @@ IDB_Decimal Func_round::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull else x = ceil(x - 0.5); - decimal.value = static_cast(x <= INT64_MIN ? INT64_MIN : x >= INT64_MAX ? INT64_MAX : int64_t(x)); + decimal.value = x <= static_cast(INT64_MIN) ? INT64_MIN + : x >= static_cast(INT64_MAX) ? INT64_MAX + : int64_t(x); decimal.scale = s; } } diff --git a/utils/funcexp/func_truncate.cpp b/utils/funcexp/func_truncate.cpp index 5371327a4..32f09843d 100644 --- a/utils/funcexp/func_truncate.cpp +++ b/utils/funcexp/func_truncate.cpp @@ -440,7 +440,9 @@ IDB_Decimal Func_truncate::getDecimalVal(Row& row, FunctionParm& parm, bool& isN if (!isNull) { x *= p; - decimal.value = static_cast(x <= INT64_MIN ? INT64_MIN : x >= INT64_MAX ? INT64_MAX : int64_t(x)); + decimal.value = x <= static_cast(INT64_MIN) ? INT64_MIN + : x >= static_cast(INT64_MAX) ? INT64_MAX + : int64_t(x); decimal.scale = s; } }