This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d8ec7797054 [Bug](function) add index check on function like (#47991)
d8ec7797054 is described below

commit d8ec7797054c71f7ba9f7903ac4e60f26f299732
Author: Pxl <x...@selectdb.com>
AuthorDate: Tue Feb 18 17:28:47 2025 +0800

    [Bug](function) add index check on function like (#47991)
    
    ### What problem does this PR solve?
    Sometimes we encounter offset[last]<chars.size(), since we can't
    completely avoid this situation at the moment, we will add protective
    code here first.
    
    related check&fix : https://github.com/apache/doris/pull/47964
    
    ```cpp
    false, DefaultMemoryAllocator>, pad_right_ = 16, pad_left_ = 15]: 假设 ‘(n >= 
(static_cast<ssize_t>(pad_left_) ? -1 : 0)) && (n <= 
static_cast<ssize_t>(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<unsigned int, 4096ul, Allocator<false, 
false, false, DefaultMemoryAllocator>, 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<unsigned
 char, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 
15ul> const&, doris::vectorized::PODArray<unsigned int, 4096ul, 
Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul> const&, 
doris::vectorized::PODArray<unsigned char, 4096ul, Allocator<false, false, 
false, DefaultMemoryAllocator>, 16ul, 15ul>&, 
doris::vectorized::LikeSearchState*) const at /mnt/disk2 [...]
     8# 
doris::vectorized::FunctionLikeBase::execute_impl(doris::FunctionContext*, 
doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned 
long> > 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<unsigned long, std::allocator<unsigned 
long> > 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<unsigned long, std::allocator<unsigned 
long> > 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 <!-- At least one of them must be included. -->
        - [ ] 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 <!-- Add your reason?  -->
    
    - Behavior changed:
        - [x] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [x] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### 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 <!-- Add branch pick label that this PR
    should merge into -->
---
 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 d727ba6e850..09bfc961a2e 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;
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to