You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/02/19 15:10:00 UTC

[jira] [Commented] (ARROW-11694) [C++] Array Take may dereference absent null bitmap

    [ https://issues.apache.org/jira/browse/ARROW-11694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17287113#comment-17287113 ] 

Antoine Pitrou commented on ARROW-11694:
----------------------------------------

Quick drive-by patch:
{code:c++}
diff --git a/cpp/src/arrow/compute/kernels/util_internal.cc b/cpp/src/arrow/compute/kernels/util_internal.cc
index 93badbd3b..1656ed2aa 100644
--- a/cpp/src/arrow/compute/kernels/util_internal.cc
+++ b/cpp/src/arrow/compute/kernels/util_internal.cc
@@ -53,7 +53,7 @@ PrimitiveArg GetPrimitiveArg(const ArrayData& arr) {
     arg.data += arr.offset * arg.bit_width / 8;
   }
   // This may be kUnknownNullCount
-  arg.null_count = arr.null_count.load();
+  arg.null_count = (arg.is_valid != nullptr) ? arr.null_count.load() : 0;
   return arg;
 }
 
{code}

> [C++] Array Take may dereference absent null bitmap
> ---------------------------------------------------
>
>                 Key: ARROW-11694
>                 URL: https://issues.apache.org/jira/browse/ARROW-11694
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Python
>    Affects Versions: 3.0.0
>         Environment: macOS, ubuntu
>            Reporter: A. Coady
>            Priority: Critical
>             Fix For: 4.0.0
>
>
> Sorting a non-chunked array has some sort of reference problem. Some operations on the resulting indices array crash.
> {code:python}
> import pyarrow as pa, pyarrow.compute as pc
> array = pa.array(list("abcba"))
> assert pc.sort_indices(pa.chunked_array([array])).take([0])
> assert pc.array_sort_indices(pa.chunked_array([array])).take([0])
> pc.sort_indices(array).take([0])  # crash
> pc.array_sort_indices(array).take([0])  # crash
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)