You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2018/12/17 11:02:52 UTC

[GitHub] imay closed pull request #440: Fix memory_copy core dump in aggregate

imay closed pull request #440: Fix memory_copy core dump in aggregate
URL: https://github.com/apache/incubator-doris/pull/440
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/be/src/olap/aggregate_func.h b/be/src/olap/aggregate_func.h
index 2c627952..4fe5da96 100644
--- a/be/src/olap/aggregate_func.h
+++ b/be/src/olap/aggregate_func.h
@@ -195,12 +195,13 @@ struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_REPLACE, OLAP_FIELD_TYPE_LARGE
 template <>
 struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_REPLACE, OLAP_FIELD_TYPE_CHAR> {
     static void aggregate(char* left, const char* right, Arena* arena) {
+        bool l_null = *reinterpret_cast<bool*>(left);
         bool r_null = *reinterpret_cast<const bool*>(right);
         *reinterpret_cast<bool*>(left) = r_null;
         if (!r_null) {
             Slice* l_slice = reinterpret_cast<Slice*>(left + 1);
             const Slice* r_slice = reinterpret_cast<const Slice*>(right + 1);
-            if (arena == nullptr || l_slice->size >= r_slice->size) {
+            if (arena == nullptr || (!l_null && l_slice->size >= r_slice->size)) {
                 memory_copy(l_slice->data, r_slice->data, r_slice->size);
                 l_slice->size = r_slice->size;
             } else {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org