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/01/01 11:50:32 UTC

[GitHub] [arrow] jhorstmann commented on a change in pull request #8997: ARROW-10692: [Rust] Removed undefined behavior derived from null pointers

jhorstmann commented on a change in pull request #8997:
URL: https://github.com/apache/arrow/pull/8997#discussion_r550760971



##########
File path: rust/arrow/src/buffer.rs
##########
@@ -213,13 +222,33 @@ impl<T: AsRef<[u8]>> From<T> for Buffer {
         let len = slice.len() * mem::size_of::<u8>();
         let capacity = bit_util::round_upto_multiple_of_64(len);
         let buffer = memory::allocate_aligned(capacity);
+        // JUSTIFICATION
+        //  Benefit
+        //      It is often useful to create a buffer from bytes, typically when they are allocated by external sources
+        //  Soundness
+        //      * The pointers are non-null by construction
+        //      * alignment asserted above
+        //  Unsoundness
+        //      * There is no guarantee that the memory regions do are non-overalling, but `memcpy` requires this.

Review comment:
       Since `buffer` is freshly allocated it should not be possible for the memory regions to overlap




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

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