Skip to content

fix: mark raw waker callbacks unsafe#84

Open
Sieger9303 wants to merge 1 commit into
async-rs:masterfrom
Sieger9303:fix-raw-waker-callback-safety
Open

fix: mark raw waker callbacks unsafe#84
Sieger9303 wants to merge 1 commit into
async-rs:masterfrom
Sieger9303:fix-raw-waker-callback-safety

Conversation

@Sieger9303
Copy link
Copy Markdown

Fixes #80.

Hi, thanks for maintaining this crate.

The RawWaker callbacks reconstruct an Arc<Thread> from the raw pointer passed by the waker vtable. This is only valid when the pointer was originally produced by Arc::<Thread>::into_raw and follows the ownership rules required by the RawWakerVTable.

Previously these callback functions were plain safe functions, even though calling them directly with an arbitrary pointer could cause undefined behavior. This PR marks the callbacks as unsafe fn. The actual runtime behavior is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function futures-timer/src/native/global/raw_drop, raw_wake, raw_clone, and raw_wake_by_ref can trigger invalid memory reference

1 participant