tustvold commented on code in PR #3920:
URL: https://github.com/apache/arrow-rs/pull/3920#discussion_r1148350060
##########
arrow-buffer/src/buffer/mutable.rs:
##########
@@ -67,14 +68,21 @@ impl MutableBuffer {
/// Allocate a new [MutableBuffer] with initial capacity to be at least
`capacity`.
#[inline]
- #[allow(deprecated)]
pub fn with_capacity(capacity: usize) -> Self {
let capacity = bit_util::round_upto_multiple_of_64(capacity);
- let ptr = alloc::allocate_aligned(capacity);
+ let layout = Layout::from_size_align(capacity, ALIGNMENT).unwrap();
Review Comment:
> from_size_align seems also rounding capacity
It doesn't round, it just verifies that the allocation isn't large enough to
overflow isize and cause UB
--
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]