Skip to content

Commit

Permalink
Mark internal, hidden LLVMFuzzerTestOneInput LibFuzzer hook as `uns…
Browse files Browse the repository at this point in the history
…afe`

Fixes #112
  • Loading branch information
fitzgen committed Sep 14, 2023
1 parent b3f9e4f commit f267b63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ extern "C" {
fn LLVMFuzzerMutate(data: *mut u8, size: usize, max_size: usize) -> usize;
}

/// Do not use; only for LibFuzzer's consumption.
#[doc(hidden)]
#[export_name = "LLVMFuzzerTestOneInput"]
pub fn test_input_wrap(data: *const u8, size: usize) -> i32 {
let test_input = ::std::panic::catch_unwind(|| unsafe {
pub unsafe fn test_input_wrap(data: *const u8, size: usize) -> i32 {
let test_input = ::std::panic::catch_unwind(|| {
let data_slice = ::std::slice::from_raw_parts(data, size);
rust_fuzzer_test_input(data_slice)
});
Expand Down

0 comments on commit f267b63

Please sign in to comment.