Skip to content

Safe code can implement Message and therefore Object traits for any type to invoke undefined behavior #7

@SSheldon

Description

@SSheldon

Implementing Message doesn't require actually implementing anything, and then implementing INSObject doesn't require any unsafe code. Safe code therefore can implement INSObject for types that it shouldn't and invoke undefined behavior by calling the INSObject methods.

impl Message for uint { }

impl INSObject for uint {
    fn class_name() -> ClassName<uint> {
        ClassName("uint")
    }
}

fn main() {
    let x = 0u;
    let hash_code = x.hash_code();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions