Skip to content

It's possible to cast 0 as extern fn() in safe code #8728

Closed
@bluss

Description

@bluss

Rust allows casting 0 to a function pointer type like extern "Rust" fn(). This is unsafe.

rusti: let f = 0 as extern "Rust" fn() -> int; f()
-rusti:#rust- application terminated abnormally with signal 11 (Segmentation fault)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions