Skip to content

Add sections about fuzzing APIs with callbacks#53

Merged
fitzgen merged 3 commits intorust-fuzz:masterfrom
Evian-Zhang:fuzz-callback
Feb 18, 2026
Merged

Add sections about fuzzing APIs with callbacks#53
fitzgen merged 3 commits intorust-fuzz:masterfrom
Evian-Zhang:fuzz-callback

Conversation

@Evian-Zhang
Copy link
Copy Markdown
Contributor

I found that Rust APIs with callbacks need special handling when writing fuzzing harnesses, and I wrote a simple crate touched to make things easier. I think it may be great to add a section to make more people aware of this problem.

Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content looks good ot me, but this isn't really about callbacks, it is more about ASan and accessing data. For example, you could have

pub fn api_with_return(user_data: &[u8]) -> &[u8] {
    let dangling_data_ptr: *mut u32 = process_user_data(user_data);
    let data_len: usize = HARDCODED_VALUE;
    let data = unsafe { std::slice::from_raw_parts(dangling_data_ptr, data_len) };
    data
}

which would exhibit the same issues as the callback example.

I think a better title for this page would be something like

Writing Oracles that Access Data

or something along those lines.

@Evian-Zhang
Copy link
Copy Markdown
Contributor Author

Thank you for this great suggestion! I have updated the text. :)

Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just one final nitpick below.

Comment thread src/cargo-fuzz/oracles-accessing-data.md Outdated
@fitzgen fitzgen merged commit 1ebe52b into rust-fuzz:master Feb 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants