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/08/23 12:40:34 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #10969: ARROW-13676: [C++][Parquet] Avoid potential invalid access.

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



##########
File path: cpp/src/parquet/arrow/path_internal_test.cc
##########
@@ -170,6 +170,24 @@ TEST_F(MultipathLevelBuilderTest, NullableSingleListWithAllNullsLists) {
                      /*rep_levels=*/std::vector<int16_t>(4, 0));
 }
 
+TEST_F(MultipathLevelBuilderTest, EmptyLists) {
+  // ARROW-13676 - ensure no out of bounds list memory accesses.
+  auto entries = field("Entries", ::arrow::int64());
+  auto list_type = list(entries);

Review comment:
       Can you add a "translates to parquet schema" comment as above?

##########
File path: cpp/src/parquet/arrow/path_internal.cc
##########
@@ -342,7 +341,9 @@ class ListPathNode {
     *child_range = selector_.GetRange(range->start);
     while (child_range->Empty() && !range->Empty()) {
       ++range->start;
-      *child_range = selector_.GetRange(range->start);
+      if (!range->Empty()) {
+        *child_range = selector_.GetRange(range->start);
+      }
     }

Review comment:
       Would be nice to clean up the repetition of conditionals here, for example:
   ```c++
   int64_t empty_elements = 0;
   do {
     *child_range = selector_.GetRange(range->start++);
     if (!child_range->Empty()) {
       break;
     }
     ++empty_elements;
   } while (!range->Empty());
   ```




-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org