From 20cb73d39f1ccb9386e45edfc644413edbade0bc Mon Sep 17 00:00:00 2001 From: qwertz19281 Date: Thu, 4 Feb 2021 01:40:04 +0100 Subject: [PATCH] Vec::insert_slice_clone: fix unsound Vec after T::clone panic --- src/imp/vec.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/imp/vec.rs b/src/imp/vec.rs index a24ed59..39cb0d4 100644 --- a/src/imp/vec.rs +++ b/src/imp/vec.rs @@ -81,6 +81,7 @@ impl VecExt for Vec { } unsafe { + self.set_len(0); { let mut p = self.as_mut_ptr().add(index); ptr::copy(p, p.add(slen), vlen - index);