[ 
https://issues.apache.org/jira/browse/ARROW-2441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16432846#comment-16432846
 ] 

ASF GitHub Bot commented on ARROW-2441:
---------------------------------------

pitrou closed pull request #1877: ARROW-2441: [Rust] Builder<T>::slice_mut 
assertions are too strict
URL: https://github.com/apache/arrow/pull/1877
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/rust/src/builder.rs b/rust/src/builder.rs
index 15f492d6d..421b1a9a1 100644
--- a/rust/src/builder.rs
+++ b/rust/src/builder.rs
@@ -65,8 +65,8 @@ impl<T> Builder<T> {
     /// Get the internal byte-aligned memory buffer as a mutable slice
     pub fn slice_mut(&self, start: usize, end: usize) -> &mut [T] {
         assert!(start <= end);
-        assert!(start < self.len as usize);
-        assert!(end <= self.len as usize);
+        assert!(start < self.capacity as usize);
+        assert!(end <= self.capacity as usize);
         unsafe {
             slice::from_raw_parts_mut(self.data.offset(start as isize), (end - 
start) as usize)
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Rust] Builder<T>::slice_mut assertions are too strict
> ------------------------------------------------------
>
>                 Key: ARROW-2441
>                 URL: https://issues.apache.org/jira/browse/ARROW-2441
>             Project: Apache Arrow
>          Issue Type: Bug
>            Reporter: Andy Grove
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.10.0
>
>
> The assertions only allow slice up to builder length, rather than up to 
> builder capacity.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to