Skip to content

Commit dc4dc35

Browse files
authored
Fix problem with the negation (#10971)
1 parent a01c161 commit dc4dc35

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/swoc/src/TextView.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ svtoi(TextView src, TextView *out, int base) {
6363
out->assign(start, parsed.data_end());
6464
}
6565
if (neg) {
66-
zret = -intmax_t(std::min<uintmax_t>(n, ABS_MIN));
66+
uintmax_t temp = std::min<uintmax_t>(n, ABS_MIN);
67+
if (temp == ABS_MIN) {
68+
zret = std::numeric_limits<intmax_t>::min();
69+
} else {
70+
zret = -intmax_t(temp);
71+
}
6772
} else {
6873
zret = std::min(n, ABS_MAX);
6974
}

0 commit comments

Comments
 (0)