提交 5ade6a52 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] Fix zero number exponent overflows

上级 8f6468f3
...@@ -363,7 +363,8 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc ...@@ -363,7 +363,8 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc
nth += i_nth; nth += i_nth;
} }
warning = OB_INVALID_NUMERIC; warning = OB_INVALID_NUMERIC;
} else if (0 == valid_len) { } else if (0 == valid_len || 0 == i_nth) {
// `i_nth = 0` means all digits are zero.
/* ignore e's value; only do the check*/ /* ignore e's value; only do the check*/
cur = str[++i]; cur = str[++i];
if ('-' == cur || '+' == cur) { if ('-' == cur || '+' == cur) {
...@@ -524,8 +525,9 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc ...@@ -524,8 +525,9 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc
K(e_neg), K(e_neg),
K(e_value), K(e_value),
K(valid_len), K(valid_len),
K(i)); K(i),
if (as_zero || 0 == valid_len) { K(i_nth));
if (as_zero || 0 == valid_len || 0 == i_nth) {
full_str[0] = '0'; full_str[0] = '0';
nth = 1; nth = 1;
set_zero(); set_zero();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册