A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rkyv/rkyv/commit/a9417193a34757e12e24263178be8b2eebb72456 below:

Fix potential UB in `AlignedVec::into_boxed_slice` · rkyv/rkyv@a941719 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+2

-7

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+2

-7

lines changed Original file line number Diff line number Diff line change

@@ -509,13 +509,8 @@ impl AlignedVec {

509 509

/// assert_eq!(slice.len(), 3);

510 510

/// ```

511 511

#[inline]

512 -

pub fn into_boxed_slice(mut self) -> Box<[u8]> {

513 -

unsafe {

514 -

self.shrink_to_fit();

515 -

let slice_ptr = ptr_meta::from_raw_parts_mut(self.as_mut_ptr().cast(), self.len);

516 -

core::mem::forget(self);

517 -

Box::from_raw(slice_ptr)

518 -

}

512 +

pub fn into_boxed_slice(self) -> Box<[u8]> {

513 +

self.into_vec().into_boxed_slice()

519 514

}

520 515 521 516

/// Converts the vector into `Vec<u8>`.

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4