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 9b6d50bfeff [ub](pod array) fix  applying non-zero offset 16 to null 
pointer (#36086)
9b6d50bfeff is described below

commit 9b6d50bfeffcd682b5bbb9fe23d47f613311fa1f
Author: Mryange <[email protected]>
AuthorDate: Wed Jun 12 17:59:31 2024 +0800

    [ub](pod array) fix  applying non-zero offset 16 to null pointer (#36086)
    
    ## Proposed changes
    
    ```
    /root/doris/be/src/vec/common/pod_array.h:448:13: runtime error: applying 
non-zero offset 16 to null pointer
        #0 0x562f904159f3 in void 
doris::vectorized::PODArray<doris::vectorized::AggregateFunctionSequenceMatchData<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long, 
doris::vectorized::AggregateFunctionSequenceMatch<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long> >::PatternAction, 64ul, 
AllocatorWithStackMemory<Allocator<false, false, false>, 64ul, 8ul>, 0ul, 
0ul>::emplace_back<doris::vectorized::AggregateFunctionSequenceMatchData<doris::DateV2Value<doris::Date
 [...]
        #1 0x562f90412d6a in 
doris::vectorized::AggregateFunctionSequenceMatchData<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long, 
doris::vectorized::AggregateFunctionSequenceMatch<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long> >::parse_pattern() 
/root/doris/be/src/vec/aggregate_functions/aggregate_function_sequence_match.h:208:17
        #2 0x562f9040a824 in 
doris::vectorized::AggregateFunctionSequenceMatchData<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long, 
doris::vectorized::AggregateFunctionSequenceMatch<doris::DateV2Value<doris::DateTimeV2ValueType>,
 unsigned long> >::init(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, unsigned long) 
/root/doris/be/src/vec/aggregate_functions/aggregate_function_sequence_match.h:95:13
    ```
    
    this->c_end may be nullptr
---
 be/src/vec/common/pod_array.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/common/pod_array.h b/be/src/vec/common/pod_array.h
index 9a00e295cb3..d4324c91f75 100644
--- a/be/src/vec/common/pod_array.h
+++ b/be/src/vec/common/pod_array.h
@@ -445,7 +445,8 @@ public:
       */
     template <typename... Args>
     void emplace_back(Args&&... args) {
-        if (UNLIKELY(this->c_end + sizeof(T) > this->c_end_of_storage)) {
+        if (UNLIKELY(this->c_end == nullptr ||
+                     (this->c_end + sizeof(T) > this->c_end_of_storage))) {
             this->reserve_for_next_size();
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to