cocoa-xu commented on code in PR #507:
URL: https://github.com/apache/arrow-nanoarrow/pull/507#discussion_r1627819921
##########
src/nanoarrow/array.c:
##########
@@ -846,6 +856,75 @@ static int ArrowArrayViewValidateMinimal(struct
ArrowArrayView* array_view,
return EINVAL;
}
break;
+
+ case NANOARROW_TYPE_RUN_END_ENCODED:
+ if (array_view->n_children != 2) {
+ ArrowErrorSet(error,
+ "Expected 2 children for run-end encoded array but found
%ld",
+ (long)array_view->n_children);
+ return EINVAL;
+ }
+ struct ArrowArrayView* run_ends_view;
+ struct ArrowArrayView* values_view;
+ run_ends_view = array_view->children[0];
+ values_view = array_view->children[1];
+ if (run_ends_view == NULL) {
+ ArrowErrorSet(error, "Run ends array is null pointer");
+ return EINVAL;
+ }
+ if (values_view == NULL) {
+ ArrowErrorSet(error, "Values array is null pointer");
+ return EINVAL;
+ }
+ uint64_t max_length;
Review Comment:
But if the malformed array_view has an `offset = INT64_MAX - 1` and `length
= 2`, that would cause an overflow and we wouldn't be able to test that
scenario (after this `switch` block).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]