Skip to content

Null pointers (and then UB) when creating two Sorts with the same name #313

@shelvacu

Description

@shelvacu

repro:

use z3::Sort;

fn main() {
    let cfg = z3::Config::new();
    let ctx = z3::Context::new(&cfg);

    let res1 = Sort::enumeration(
        &ctx,
        "SameNameSort".into(),
        &["A".into(), "B".into(),]
    );
    dbg!(&res1);
    let res2 = Sort::enumeration(
        &ctx,
        "SameNameSort".into(),
        &["C".into(), "D".into(),]
    );
    dbg!(&res2);
}

This manages to show the issue without triggering any UB, but doing anything interesting with res2 gives a nullptr exception

I'm not sure what exactly is supposed to happen, but at the very least this should panic!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions