From 1aad5c4f41bc20aa2b2e2391fb9255c93d4ec476 Mon Sep 17 00:00:00 2001 From: Pxl Date: Tue, 18 Feb 2025 17:28:47 +0800 Subject: [PATCH] [Bug](function) add index check on function like (#47991) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Sometimes we encounter offset[last], pad_right_ = 16, pad_left_ = 15]: 假设 ‘(n >= (static_cast(pad_left_) ? -1 : 0)) && (n <= static_cast(this->size()))’ 失败。 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/common/signal_handler.h:421 1# 0x00007F756FE8BB50 in /lib64/libc.so.6 2# gsignal in /lib64/libc.so.6 3# __GI_abort in /lib64/libc.so.6 4# _nl_load_domain.cold.0 in /lib64/libc.so.6 5# 0x00007F756FE84426 in /lib64/libc.so.6 6# doris::vectorized::PODArray, 16ul, 15ul>::operator[](long) const at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/vec/common/pod_array.h:365 7# doris::vectorized::FunctionLikeBase::execute_substring(doris::vectorized::PODArray, 16ul, 15ul> const&, doris::vectorized::PODArray, 16ul, 15ul> const&, doris::vectorized::PODArray, 16ul, 15ul>&, doris::vectorized::LikeSearchState*) const at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/vec/functions/like.cpp:580 8# doris::vectorized::FunctionLikeBase::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector > const&, unsigned long, unsigned long) const at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/vec/functions/like.cpp:532 9# doris::vectorized::DefaultExecutable::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector > const&, unsigned long, unsigned long) const at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/vec/functions/function.h:461 10# doris::vectorized::PreparedFunctionImpl::_execute_skipped_constant_deal(doris::FunctionContext*, doris::vectorized::Block&, std::vector > const&, unsigned long, unsigned long, bool) const at /mnt/disk2/liyuanyuan/doris_test/3.0/doris/be/src/vec/functions/function.cpp:120 ``` ### Check List (For Author) - Test - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [x] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [x] Other reason - Behavior changed: - [x] No. - [ ] Yes. - Does this need documentation? - [x] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [x] Confirm the release note - [x] Confirm test cases - [x] Confirm document - [x] Add branch pick label --- be/src/vec/functions/like.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp index 842cfabbe19fdf..d67bb83c05c473 100644 --- a/be/src/vec/functions/like.cpp +++ b/be/src/vec/functions/like.cpp @@ -573,7 +573,7 @@ Status FunctionLikeBase::execute_substring(const ColumnString::Chars& values, /// Determine which index it refers to. /// begin + value_offsets[i] is the start offset of string at i+1 - while (begin + value_offsets[i] < pos) { + while (i < value_offsets.size() && begin + value_offsets[i] < pos) { ++i; }