This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit 66f11ff19e237dc5aefaf7e923ce63697af60cd6
Author: Brian Neradt <[email protected]>
AuthorDate: Tue Mar 19 17:52:33 2024 +0000

    Fix problem with the negation (#10971)
    
    (cherry picked from commit dc4dc35780a923fbe8759994f481250b8486a505)
---
 code/src/TextView.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/code/src/TextView.cc b/code/src/TextView.cc
index fbfb343..5e6cd74 100644
--- a/code/src/TextView.cc
+++ b/code/src/TextView.cc
@@ -63,7 +63,12 @@ svtoi(TextView src, TextView *out, int base) {
         out->assign(start, parsed.data_end());
       }
       if (neg) {
-        zret = -intmax_t(std::min<uintmax_t>(n, ABS_MIN));
+        uintmax_t temp = std::min<uintmax_t>(n, ABS_MIN);
+        if (temp == ABS_MIN) {
+          zret = std::numeric_limits<intmax_t>::min();
+        } else {
+          zret = -intmax_t(temp);
+        }
       } else {
         zret = std::min(n, ABS_MAX);
       }

Reply via email to