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 2022/11/22 14:05:00 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #3157: Check overflow in MutableArrayData extend offsets (#3123)

alamb commented on code in PR #3157:
URL: https://github.com/apache/arrow-rs/pull/3157#discussion_r1029371320


##########
arrow-data/src/transform/utils.rs:
##########
@@ -36,7 +36,7 @@ pub(super) fn extend_offsets<T: ArrowNativeType + Integer>(
     offsets.windows(2).for_each(|offsets| {
         // compute the new offset
         let length = offsets[1] - offsets[0];
-        last_offset = last_offset + length;
+        last_offset = last_offset.checked_add(&length).expect("offset overflow");

Review Comment:
   I think panic'ing rather than segfaulting is a much better practice



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