You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by yi...@apache.org on 2022/04/14 05:02:37 UTC

[arrow] branch master updated: ARROW-16185: [C++] Fix uninitialized output data in strptime kernel

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

yibocai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new b61fb727fc ARROW-16185: [C++] Fix uninitialized output data in strptime kernel
b61fb727fc is described below

commit b61fb727fcc9a1c1e04002433bf502650b6ad369
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Thu Apr 14 05:02:14 2022 +0000

    ARROW-16185: [C++] Fix uninitialized output data in strptime kernel
    
    Closes #12874 from pitrou/ARROW-16185-valgrind-strptime
    
    Authored-by: Antoine Pitrou <an...@python.org>
    Signed-off-by: Yibo Cai <yi...@arm.com>
---
 cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
index 2c5548177a..8df24f733f 100644
--- a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
+++ b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
@@ -1208,7 +1208,7 @@ struct Strptime {
       arrow::internal::BitmapWriter out_writer(out->GetMutableValues<uint8_t>(0, 0),
                                                out->offset, out->length);
       auto visit_null = [&]() {
-        out_data++;
+        *out_data++ = 0;
         out_writer.Next();
         null_count++;
       };
@@ -1217,7 +1217,7 @@ struct Strptime {
         if ((*self.parser)(s.data(), s.size(), self.unit, &result)) {
           *out_data++ = result;
         } else {
-          out_data++;
+          *out_data++ = 0;
           out_writer.Clear();
           null_count++;
         }
@@ -1228,7 +1228,7 @@ struct Strptime {
       out->null_count = null_count;
     } else {
       auto visit_null = [&]() {
-        out_data++;
+        *out_data++ = 0;
         return Status::OK();
       };
       auto visit_value = [&](util::string_view s) {