wleeaf commented on code in PR #11881:
URL: https://github.com/apache/arrow-rs/pull/11881#discussion_r4366737168


##########
arrow-ipc/src/reader.rs:
##########
@@ -72,6 +72,19 @@ fn read_buffer(
         }
     }
 }
+
+/// Like [`Buffer::slice_with_length`], but returns an error instead of 
panicking
+/// if the range is out of bounds
+fn slice_buffer(buffer: &Buffer, offset: usize, length: usize) -> 
Result<Buffer, ArrowError> {

Review Comment:
   Done in 46241c89: added `Buffer::checked_slice_with_length(offset, length) 
-> Option<Buffer>`, the non-panicking counterpart of `slice_with_length`, 
modeled on `slice::get`. It returns an `Option` rather than a `Result` because 
`arrow-buffer` has no `ArrowError` (same as its `checked_*` methods). The IPC 
reader now only maps `None` to an `IpcError`. There's a unit test for the new 
method in `arrow-buffer`.
   
   CI is enabled in the fork now: the branches predated #11788, so I rebased 
them on main and the fork runs pass.
   



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

Reply via email to