Skip to content

RUSTSEC-2026-0156 Bad-free in `MetaCallException::new`

Unknown
Published
Updated
Exploit status
No public exploit known

Description

exception_struct is a local stack variable, but the code passes its address to the C language as &mut exception_struct as *mut _ as *mut c_void. Then, the returned MetaCallException value is stored here:

Ok(Self {
    exception_struct: Arc::new(exception_struct),
    value: exception_ptr,
    leak: false,
})

Because leak is false, the destructor will run later. But the original exception pointer points to Rust stack memory.

Trigger

#[test]
fn exception_bad_free_safe_api() {
    let original = metacall::MetaCallException::new(
        "test",
        "test",
        "test",
        1,
    );

    drop(original); // AddressSanitizer: bad-free
}

Impact

Every time the MetaCallException is created, when it is dropped, it leads to a bad-free. This can be triggered through the safe public API MetaCallException::new(), with no unsafe required from the caller.

Upgrade path

1 package: 0 fixed, 1 with no fix yet.

PackageAffectedFixed inStatus
crates.io metacall(crates.io) >= 0.0.0-0 No fix listed No fix yet

Affected products

ProductAffected versionsFixed in
crates.io metacall(crates.io) >= 0.0.0-0 No fix listed

References