-
-
Notifications
You must be signed in to change notification settings - Fork 15k
CoerceShared can violate privacy #156566
Copy link
Copy link
Open
Labels
A-coherenceArea: CoherenceArea: CoherenceA-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.F-reborrow`#![feature(reborrow)]`; see #145612`#![feature(reborrow)]`; see #145612I-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/SoundnessT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-coherenceArea: CoherenceArea: CoherenceA-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.F-reborrow`#![feature(reborrow)]`; see #145612`#![feature(reborrow)]`; see #145612I-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/SoundnessT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The
CoerceSharedtrait can be implemented to allow coercing from a local type to a foreign type. (Notably, the foreign crate does not need to usefeature(reborrow)at all.) This allows creating an instance of that foreign type without going through public API, which can be used to violate invariants of the type.As an example, the following code compiles and causes a null pointer dereference at run time.
dep/src/lib.rs:
src/main.rs:
cc @aapoalas
Meta
rustc --version --verbose: