Panic on unlikely source code.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 386
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 1
Description
Hi,
I am the Co-Lead of the Cargo Team and was recently hired by the Rust Foundation to help triage AI discovered bugs. This bug was found with AI, namely scrutineer and gpt-5.6-sol. Except where specifically labeled this report was written by me. Most of the AI findings are bogus because they assume you're running against untrusted input. On the other hand, several of them are interesting ways to make the CLI crash.
/// cbindgen:rename-all=not-a-valid-rename-rule
#[repr(C)]
pub struct Trigger { pub field: u8 }
cbindgen --lang c /tmp/poc-annotation.rs -> called 'Option::unwrap()' on a None value
The following snippets each reach a reasonably descriptive assertion failure.
#[repr(C)]
pub struct Pair<T> { pub value: T }
pub type Trigger = Pair<u8, u16>;
#[repr(C)]
pub struct Pair<T, U> { pub first: T, pub second: U }
pub type Trigger = Pair<u8>;
pub struct Opaque<T> { private: T }
pub type Trigger = Opaque<u8, u16>;
A malformed lock file
version = 3
[[package]]
name = "repro"
version = "0.1.0"
dependencies = [""]
Gives index out of bounds: the len is 0 but the index is 0
#[path = "root.rs"]
mod recursive;
pub struct Trigger;
Leads to a stack overflow or segmentation fault.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported cases with cbindgen --lang c /tmp/poc-annotation.rs and the malformed lock file and recursive module snippets. The report identifies unwrap, index-out-of-bounds, assertion, stack-overflow, and segmentation-fault failures but does not name source files or tests. Done means the supplied inputs no longer crash cbindgen and retain descriptive diagnostics where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100