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

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


The following commit(s) were added to refs/heads/master by this push:
     new 64f71dd  [fix](be-ut) fix segmentation fault at unaligned address 
int128 (#8021)
64f71dd is described below

commit 64f71ddae3d520836308d23fe1dc8fc4149cb0b1
Author: Pxl <952130...@qq.com>
AuthorDate: Mon Feb 14 09:29:05 2022 +0800

    [fix](be-ut) fix segmentation fault at unaligned address int128 (#8021)
---
 be/test/olap/row_cursor_test.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/test/olap/row_cursor_test.cpp b/be/test/olap/row_cursor_test.cpp
index 3a4ade4..9dd2447 100644
--- a/be/test/olap/row_cursor_test.cpp
+++ b/be/test/olap/row_cursor_test.cpp
@@ -311,7 +311,7 @@ TEST_F(TestRowCursor, InitRowCursorWithScanKey) {
     scan_keys.push_back("char_exceed_length");
     scan_keys.push_back("varchar_exceed_length");
 
-    std::vector<uint32_t> columns{0, 1};
+    std::vector<uint32_t> columns {0, 1};
     std::shared_ptr<Schema> schema = 
std::make_shared<Schema>(tablet_schema.columns(), columns);
 
     RowCursor row;
@@ -498,7 +498,8 @@ TEST_F(TestRowCursor, AggregateWithoutNull) {
 
     agg_update_row(&row, right, nullptr);
 
-    int128_t agg_value = *reinterpret_cast<int128_t*>(row.cell_ptr(2));
+    int128_t agg_value = 0;
+    memcpy(&agg_value, row.cell_ptr(2), 16);
     ASSERT_TRUE(agg_value == ((int128_t)(1) << 101));
 
     double agg_double = *reinterpret_cast<double*>(row.cell_ptr(3));
@@ -558,7 +559,8 @@ TEST_F(TestRowCursor, AggregateWithNull) {
 
     agg_update_row(&row, right, nullptr);
 
-    int128_t agg_value = *reinterpret_cast<int128_t*>(row.cell_ptr(2));
+    int128_t agg_value = 0;
+    memcpy(&agg_value, row.cell_ptr(2), 16);
     ASSERT_TRUE(agg_value == ((int128_t)(1) << 101));
 
     bool is_null_double = left.is_null(3);

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

Reply via email to