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

lihaopeng 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 ece72611179 [Bug](fix) fix ubsan use int32_t pointer access bool value 
(#38622)
ece72611179 is described below

commit ece72611179b17ac1eff7769123f38b54cc69ad5
Author: HappenLee <happen...@hotmail.com>
AuthorDate: Thu Aug 1 21:33:35 2024 +0800

    [Bug](fix) fix ubsan use int32_t pointer access bool value (#38622)
    
    Issue Number: close #38617
---
 be/src/exprs/runtime_filter.cpp                    |  4 +-
 .../query_p0/join/test_runtime_filter_boolean.out  |  9 +++
 .../join/test_runtime_filter_boolean.groovy        | 64 ++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp
index ead2af3efb5..d259d694fdc 100644
--- a/be/src/exprs/runtime_filter.cpp
+++ b/be/src/exprs/runtime_filter.cpp
@@ -1691,8 +1691,8 @@ void IRuntimeFilter::to_protobuf(PMinMaxFilter* filter) {
 
     switch (_wrapper->column_type()) {
     case TYPE_BOOLEAN: {
-        filter->mutable_min_val()->set_boolval(*reinterpret_cast<const 
int32_t*>(min_data));
-        filter->mutable_max_val()->set_boolval(*reinterpret_cast<const 
int32_t*>(max_data));
+        filter->mutable_min_val()->set_boolval(*reinterpret_cast<const 
bool*>(min_data));
+        filter->mutable_max_val()->set_boolval(*reinterpret_cast<const 
bool*>(max_data));
         return;
     }
     case TYPE_TINYINT: {
diff --git a/regression-test/data/query_p0/join/test_runtime_filter_boolean.out 
b/regression-test/data/query_p0/join/test_runtime_filter_boolean.out
new file mode 100644
index 00000000000..5858b696341
--- /dev/null
+++ b/regression-test/data/query_p0/join/test_runtime_filter_boolean.out
@@ -0,0 +1,9 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !rf_bool --
+10     11
+10     11
+10     11
+110    11
+110    11
+110    11
+
diff --git 
a/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy 
b/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy
new file mode 100644
index 00000000000..e241909e79c
--- /dev/null
+++ b/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_runtime_filter_boolean", "query_p0") {
+    sql "drop table if exists test_runtime_filter_boolean0;"
+    sql """ create table test_runtime_filter_boolean0(k1 int, v1 boolean)
+                DUPLICATE KEY(`k1`)
+                DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+                properties("replication_num" = "1"); """
+    
+    sql """insert into test_runtime_filter_boolean0 values 
+            (10, false),
+            (10, false),
+            (10, false),
+            (110, false),
+            (110, false),
+            (110, false);"""
+
+    sql "drop table if exists test_runtime_filter_boolean1;"
+    sql """ create table test_runtime_filter_boolean1(k1 int, v1 boolean)
+                DUPLICATE KEY(`k1`)
+                DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+                properties("replication_num" = "1"); """
+    
+    sql """insert into test_runtime_filter_boolean1 values 
+            (11, false);"""
+
+
+    qt_rf_bool """
+        select
+                t0.k1, t1.k1
+        from
+                (
+                        select
+                                k1,
+                                v1
+                        from
+                                test_runtime_filter_boolean0
+                ) t0
+                inner join [shuffle] (
+                        select
+                                k1,
+                                v1
+                        from
+                                test_runtime_filter_boolean1
+                ) t1 on t0.v1 = t1.v1
+        order by
+                1,2;
+    """
+}


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

Reply via email to