From 823d00855cfeb415a6e9600643bbc71ba80e271e Mon Sep 17 00:00:00 2001 From: obdev Date: Mon, 8 Aug 2022 16:11:20 +0800 Subject: [PATCH] [CP] Fix string number accessing array out of bounds --- deps/oblib/src/lib/number/ob_number_v2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/oblib/src/lib/number/ob_number_v2.cpp b/deps/oblib/src/lib/number/ob_number_v2.cpp index 207e7d746a..7f542c5339 100644 --- a/deps/oblib/src/lib/number/ob_number_v2.cpp +++ b/deps/oblib/src/lib/number/ob_number_v2.cpp @@ -402,8 +402,11 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc if (e_cnt < 4) { e_value = e_neg ? (e_value * 10 - (cur - '0')) : (e_value * 10 + cur - '0'); } - cur = str[++i]; e_cnt++; + if (++i >= length) { + break; + } + cur = str[i]; } LOG_DEBUG("ObNumber from sci E", K(warning), K(e_neg), K(e_cnt), K(e_value), K(valid_len), K(i)); -- GitLab