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

xuyang pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new a996eea1e08 [chore](branch-1.2) fix undefined behavior detect by UBSAN 
(#29190)
a996eea1e08 is described below

commit a996eea1e0840ff00158f4c8d62870b980a2a179
Author: xy720 <22125576+xy...@users.noreply.github.com>
AuthorDate: Fri Dec 29 10:52:19 2023 +0800

    [chore](branch-1.2) fix undefined behavior detect by UBSAN (#29190)
    
    1、fix address misaligned in column_decimal.cpp
    runtime error: load of misaligned address 0x55f303445c40 for type 'int64_t' 
(aka 'long'), which requires 8 bytes alignment
    
    2、clang format some code
---
 be/src/vec/columns/column_decimal.cpp | 2 +-
 be/src/vec/exec/vunion_node.cpp       | 3 ---
 be/src/vec/functions/function_case.h  | 3 ++-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/be/src/vec/columns/column_decimal.cpp 
b/be/src/vec/columns/column_decimal.cpp
index 4faa3fa4908..066e4a18735 100644
--- a/be/src/vec/columns/column_decimal.cpp
+++ b/be/src/vec/columns/column_decimal.cpp
@@ -279,7 +279,7 @@ void ColumnDecimal<T>::insert_many_fix_len_data(const char* 
data_ptr, size_t num
         DecimalV2Value* target = (DecimalV2Value*)(data.data() + old_size);
         for (int i = 0; i < num; i++) {
             const char* cur_ptr = data_ptr + sizeof(decimal12_t) * i;
-            int64_t int_value = *(int64_t*)(cur_ptr);
+            int64_t int_value = unaligned_load<int64_t>(cur_ptr);
             int32_t frac_value = *(int32_t*)(cur_ptr + sizeof(int64_t));
             target[i].from_olap_decimal(int_value, frac_value);
         }
diff --git a/be/src/vec/exec/vunion_node.cpp b/be/src/vec/exec/vunion_node.cpp
index 199782b577b..1e6bd4d5761 100644
--- a/be/src/vec/exec/vunion_node.cpp
+++ b/be/src/vec/exec/vunion_node.cpp
@@ -171,10 +171,8 @@ Status VUnionNode::get_next_materialized(RuntimeState* 
state, Block* block) {
         }
     }
 
-
     block->swap(mblock.to_block());
 
-
     DCHECK_LE(_child_idx, _children.size());
     return Status::OK();
 }
@@ -204,7 +202,6 @@ Status VUnionNode::get_next_const(RuntimeState* state, 
Block* block) {
         }
     }
 
-
     block->swap(mblock.to_block());
 
     // some insert query like "insert into string_test select 1, repeat('a', 
1024 * 1024);"
diff --git a/be/src/vec/functions/function_case.h 
b/be/src/vec/functions/function_case.h
index 487e1c99503..8a3b89e2f62 100644
--- a/be/src/vec/functions/function_case.h
+++ b/be/src/vec/functions/function_case.h
@@ -253,7 +253,8 @@ public:
     }
 
     template <typename IndexType>
-    void update_result_normal(MutableColumnPtr& result_column_ptr, const 
IndexType* __restrict then_idx,
+    void update_result_normal(MutableColumnPtr& result_column_ptr,
+                              const IndexType* __restrict then_idx,
                               CaseWhenColumnHolder& column_holder) {
         for (int row_idx = 0; row_idx < column_holder.rows_count; row_idx++) {
             if constexpr (!has_else) {


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

Reply via email to