You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/03 09:31:40 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #10184: ARROW-12568: [C++][Compute] Fix nullptr deference when array contains no nulls

pitrou commented on a change in pull request #10184:
URL: https://github.com/apache/arrow/pull/10184#discussion_r624976026



##########
File path: cpp/src/arrow/compute/kernels/scalar_boolean.cc
##########
@@ -379,15 +397,24 @@ struct KleeneAndNot {
     }
 
     if (left_true) {
-      GetBitmap(*out, 0).CopyFrom(GetBitmap(right, 0));
+      if (right.GetNullCount() == 0) {
+        GetBitmap(*out, 0).SetBitsTo(true);

Review comment:
       And here.

##########
File path: cpp/src/arrow/compute/kernels/scalar_boolean.cc
##########
@@ -175,15 +175,24 @@ struct KleeneAnd : Commutative<KleeneAnd> {
     }
 
     if (right_true) {
-      GetBitmap(*out, 0).CopyFrom(GetBitmap(left, 0));
+      if (left.GetNullCount() == 0) {
+        GetBitmap(*out, 0).SetBitsTo(true);

Review comment:
       How about instead:
   ```c++
   out->null_count = 0;
   out->buffers[0] = nullptr;
   ```

##########
File path: cpp/src/arrow/compute/kernels/scalar_boolean.cc
##########
@@ -266,15 +275,24 @@ struct KleeneOr : Commutative<KleeneOr> {
     }
 
     if (right_false) {
-      GetBitmap(*out, 0).CopyFrom(GetBitmap(left, 0));
+      if (left.GetNullCount() == 0) {
+        GetBitmap(*out, 0).SetBitsTo(true);

Review comment:
       Same here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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