github-actions[bot] commented on code in PR #68984:
URL: https://github.com/apache/doris/pull/68984#discussion_r4254097132
##########
be/src/util/string_parser.hpp:
##########
@@ -611,7 +612,9 @@ T StringParser::string_to_int_internal(const char*
__restrict s, int64_t len, in
switch (*s) {
case '-':
negative = true;
- max_val = StringParser::numeric_limits<T>(false) + 1;
+ // Only signed types have an extra value in their negative range.
+ // Keep the unsigned magnitude limit unchanged to avoid wrapping it to
zero.
+ max_val += std::numeric_limits<T>::is_signed;
Review Comment:
[P2] Preserve negative-source prefix conversions
`CONV('-121', -2, -10)` (and `CONV('-1a1', -10, -10)`) changes from `'-1'`
to `NULL`, although `_check_oob` still accepts these source-base magnitudes.
With `T=uint64_t`, the raw negative `base` becomes a huge unsigned divisor: the
new `UINT64_MAX` limit makes `max_div_base=1`, so the second digit triggers
`PARSE_OVERFLOW`. Its negative saturation value is now `1`, which
`ConvStringImpl` rejects as nonnegative before `handle_parse_result`. Both
inputs have a valid `-1` prefix, matching the existing out-of-base-digit
truncation behavior, so this loses a previously correct result. Please handle
the negative source radix correctly before applying this unsigned overflow
check and add these prefix cases; the new source-base range test only uses
`-10`, `0`, and `10` and misses them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]