Don't drop uninit memory when MapWindows::clone panics#156588
Conversation
|
The Miri subtree was changed cc @rust-lang/miri |
|
r? @scottmcm rustbot has assigned @scottmcm. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'm leaving libs reviews. |
This comment has been minimized.
This comment has been minimized.
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
9d22610 to
4d2dcb9
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
There was a problem hiding this comment.
@bors squash msg="Don't drop uninit memory when MapWindows::clone panics"
| fn clone(&self) -> Self { | ||
| let mut buffer = Buffer { | ||
| // Use `ManuallyDrop` until buffer is fully written to avoid dropping uninitialized elements on panic. | ||
| // (See `Buffer` rustdoc for safety invariant) |
There was a problem hiding this comment.
Hm, I guess this works, but it seems like it might be easier to just delay initializing self.start until after the write / clone complete?
But either way seems fine.
This comment has been minimized.
This comment has been minimized.
|
🔨 2 commits were squashed into 4a647a5. |
92b3b09 to
4a647a5
Compare
|
@bors r+ rollup |
…dows-clone, r=Mark-Simulacrum Don't drop uninit memory when `MapWindows::clone` panics Fixes rust-lang#156501, using the approach suggested in @bjorn3's comment rust-lang#156517 (comment)
…dows-clone, r=Mark-Simulacrum Don't drop uninit memory when `MapWindows::clone` panics Fixes rust-lang#156501, using the approach suggested in @bjorn3's comment rust-lang#156517 (comment)
…dows-clone, r=Mark-Simulacrum Don't drop uninit memory when `MapWindows::clone` panics Fixes rust-lang#156501, using the approach suggested in @bjorn3's comment rust-lang#156517 (comment)
…uwer Rollup of 13 pull requests Successful merges: - #156085 (miri: require (almost) all 1-ZST arguments to be actually passed) - #155193 (Check arguments of attributes where no arguments are expected) - #156516 (nix: remove some unneeded variables) - #156562 (Resolving Windows environment test failures) - #156588 (Don't drop uninit memory when `MapWindows::clone` panics) - #156673 (Privacy: small cleanups) - #156817 (Add `#[unsafe_eii]` to unsafe EII UI tests) - #156924 (Use #[panic_handler] rather than #[lang = "panic_impl"]) - #157055 (LLVM 23: Run AssignGUIDPass in some places) - #157108 (Add Xtensa va_arg assembly coverage) - #157220 (cg_ssa: a bit less `immediate_or_packed_pair`) - #157241 (Trace `?id.local_def_index` instead of `id` in `def_path_hash`) - #157242 (Tune backport Zulip messages)
…uwer Rollup of 13 pull requests Successful merges: - #156085 (miri: require (almost) all 1-ZST arguments to be actually passed) - #155193 (Check arguments of attributes where no arguments are expected) - #156516 (nix: remove some unneeded variables) - #156562 (Resolving Windows environment test failures) - #156588 (Don't drop uninit memory when `MapWindows::clone` panics) - #156673 (Privacy: small cleanups) - #156817 (Add `#[unsafe_eii]` to unsafe EII UI tests) - #156924 (Use #[panic_handler] rather than #[lang = "panic_impl"]) - #157055 (LLVM 23: Run AssignGUIDPass in some places) - #157108 (Add Xtensa va_arg assembly coverage) - #157220 (cg_ssa: a bit less `immediate_or_packed_pair`) - #157241 (Trace `?id.local_def_index` instead of `id` in `def_path_hash`) - #157242 (Tune backport Zulip messages)
…uwer Rollup of 13 pull requests Successful merges: - #156085 (miri: require (almost) all 1-ZST arguments to be actually passed) - #155193 (Check arguments of attributes where no arguments are expected) - #156516 (nix: remove some unneeded variables) - #156562 (Resolving Windows environment test failures) - #156588 (Don't drop uninit memory when `MapWindows::clone` panics) - #156673 (Privacy: small cleanups) - #156817 (Add `#[unsafe_eii]` to unsafe EII UI tests) - #156924 (Use #[panic_handler] rather than #[lang = "panic_impl"]) - #157055 (LLVM 23: Run AssignGUIDPass in some places) - #157108 (Add Xtensa va_arg assembly coverage) - #157220 (cg_ssa: a bit less `immediate_or_packed_pair`) - #157241 (Trace `?id.local_def_index` instead of `id` in `def_path_hash`) - #157242 (Tune backport Zulip messages)
Rollup merge of #156588 - Jules-Bertholet:fix-panicky-mapwindows-clone, r=Mark-Simulacrum Don't drop uninit memory when `MapWindows::clone` panics Fixes #156501, using the approach suggested in @bjorn3's comment #156517 (comment)
Fixes #156501, using the approach suggested in @bjorn3's comment #156517 (comment)