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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 307d4e5267a branch-30:[Bug](function) fix to_ipv6 cause 
stack-buffer-overflow error (#53713) (#54011)
307d4e5267a is described below

commit 307d4e5267a03553c39b94ec38968e8f575dc156
Author: zhangstar333 <[email protected]>
AuthorDate: Tue Aug 12 10:39:57 2025 +0800

    branch-30:[Bug](function) fix to_ipv6 cause stack-buffer-overflow error 
(#53713) (#54011)
    
    ### What problem does this PR solve?
    Problem Summary:
    cherry-pick from (#53713)
    
    ### Release note
    
    None
    
    ### 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)
        - [ ] 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.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/vec/common/format_ip.h      | 6 +++---
 be/src/vec/functions/function_ip.h | 4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/be/src/vec/common/format_ip.h b/be/src/vec/common/format_ip.h
index 45f90d3bdad..4d9b104fd63 100644
--- a/be/src/vec/common/format_ip.h
+++ b/be/src/vec/common/format_ip.h
@@ -124,12 +124,12 @@ inline void format_ipv4(const unsigned char* src, char*& 
dst, uint8_t mask_tail_
  */
 template <typename T, typename EOFfunction>
     requires(std::is_same<typename std::remove_cv<T>::type, char>::value)
-inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned char* dst, int64_t 
first_octet = -1) {
+inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned char* dst, int32_t 
first_octet = -1) {
     if (src == nullptr || first_octet > IPV4_MAX_OCTET_VALUE) {
         return false;
     }
 
-    int64_t result = 0;
+    UInt32 result = 0;
     int offset = (IPV4_BINARY_LENGTH - 1) * IPV4_OCTET_BITS;
     if (first_octet >= 0) {
         result |= first_octet << offset;
@@ -141,7 +141,7 @@ inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned 
char* dst, int64_t fir
             return false;
         }
 
-        int64_t value = 0;
+        UInt32 value = 0;
         size_t len = 0;
         while (is_numeric_ascii(*src) && len <= 3) {
             value = value * DECIMAL_BASE + (*src - '0');
diff --git a/be/src/vec/functions/function_ip.h 
b/be/src/vec/functions/function_ip.h
index 9c4737c84a7..be0f4d7ba47 100644
--- a/be/src/vec/functions/function_ip.h
+++ b/be/src/vec/functions/function_ip.h
@@ -150,10 +150,8 @@ ColumnPtr convert_to_ipv4(ColumnPtr column, const 
PaddedPODArray<UInt8>* null_ma
         vec_null_map_to = &col_null_map_to->get_data();
     }
 
-    auto col_res = ToColumn::create();
-
+    auto col_res = ToColumn::create(column_size, 0);
     auto& vec_res = col_res->get_data();
-    vec_res.resize(column_size);
 
     const ColumnString::Chars& vec_src = column_string->get_chars();
     const ColumnString::Offsets& offsets_src = column_string->get_offsets();


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

Reply via email to