-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
core::iter::repeat_n is unsound with Box<T> #130141
Copy link
Copy link
Closed
Labels
A-boxArea: Our favorite opsem complicationArea: Our favorite opsem complicationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-boxArea: Our favorite opsem complicationArea: Our favorite opsem complicationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is technically different from #130140 as there's no UAF. However, using
core::iter::repeat_nwithBox<T>has undefined behavior if you use the last/original element after moving the iterator, since theBoxfield has noalias properties.Miri Backtrace
Wrapping the element using
MaybeUninit(orMaybeDanglingonce we have that) should make this sound.