{"id":19162259,"url":"https://github.com/rust-fuzz/libfuzzer","last_synced_at":"2025-05-14T12:11:37.305Z","repository":{"id":43396115,"uuid":"82346029","full_name":"rust-fuzz/libfuzzer","owner":"rust-fuzz","description":"Rust bindings and utilities for LLVM’s libFuzzer","archived":false,"fork":false,"pushed_at":"2025-03-18T18:49:04.000Z","size":407,"stargazers_count":229,"open_issues_count":22,"forks_count":49,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-08T18:03:54.992Z","etag":null,"topics":["fuzz-testing","fuzzing","libfuzzer","rust"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-fuzz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-17T23:10:05.000Z","updated_at":"2025-05-07T23:07:24.000Z","dependencies_parsed_at":"2023-02-14T20:15:45.135Z","dependency_job_id":"36923e4b-600d-45d8-b217-c862a464b6ef","html_url":"https://github.com/rust-fuzz/libfuzzer","commit_stats":{"total_commits":129,"total_committers":27,"mean_commits":4.777777777777778,"dds":0.5658914728682171,"last_synced_commit":"a24731710f53462cbe4ee46e9e5c1bc2ae469a6f"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-fuzz%2Flibfuzzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-fuzz%2Flibfuzzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-fuzz%2Flibfuzzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-fuzz%2Flibfuzzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-fuzz","download_url":"https://codeload.github.com/rust-fuzz/libfuzzer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140766,"owners_count":22021220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fuzz-testing","fuzzing","libfuzzer","rust"],"created_at":"2024-11-09T09:09:29.178Z","updated_at":"2025-05-14T12:11:37.263Z","avatar_url":"https://github.com/rust-fuzz.png","language":"C++","readme":"# The `libfuzzer-sys` Crate\n\nBarebones wrapper around LLVM's libFuzzer runtime library.\n\nThe CPP parts are extracted from compiler-rt git repository with `git filter-branch`.\n\nlibFuzzer relies on LLVM sanitizer support. The Rust compiler has built-in support for LLVM sanitizer support, for now, it's limited to Linux. As a result, `libfuzzer-sys` only works on Linux.\n\n## Usage\n\n### Use `cargo fuzz`!\n\n[The recommended way to use this crate with `cargo fuzz`!][cargo-fuzz].\n\n[cargo-fuzz]: https://github.com/rust-fuzz/cargo-fuzz\n\n### Manual Usage\n\nThis crate can also be used manually as following:\n\nFirst create a new cargo project:\n\n```\n$ cargo new --bin fuzzed\n$ cd fuzzed\n```\n\nThen add a dependency on the `fuzzer-sys` crate and your own crate:\n\n```toml\n[dependencies]\nlibfuzzer-sys = \"0.4.0\"\nyour_crate = { path = \"../path/to/your/crate\" }\n```\n\nChange the `fuzzed/src/main.rs` to fuzz your code:\n\n```rust\n#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\n\nfuzz_target!(|data: \u0026[u8]| {\n    // code to fuzz goes here\n});\n```\n\nBuild by running the following command:\n\n```sh\n$ cargo rustc -- \\\n    -C passes='sancov-module' \\\n    -C llvm-args='-sanitizer-coverage-level=3' \\\n    -C llvm-args='-sanitizer-coverage-inline-8bit-counters' \\\n    -Z sanitizer=address\n```\n\nAnd finally, run the fuzzer:\n\n```sh\n$ ./target/debug/fuzzed\n```\n\n### Linking to a local libfuzzer\n\nWhen using `libfuzzer-sys`, you can provide your own `libfuzzer` runtime in two ways.\n\nIf you are developing a fuzzer, you can set the `CUSTOM_LIBFUZZER_PATH` environment variable to the path of your local\n`libfuzzer` runtime, which will then be linked instead of building libfuzzer as part of the build stage of `libfuzzer-sys`.\nFor an example, to link to a prebuilt LLVM 16 `libfuzzer`, you could use:\n\n```bash\n$ export CUSTOM_LIBFUZZER_PATH=/usr/lib64/clang/16/lib/libclang_rt.fuzzer-x86_64.a\n$ cargo fuzz run ...\n```\n\nAlternatively, you may also disable the default `link_libfuzzer` feature:\n\nIn `Cargo.toml`:\n```toml\n[dependencies]\nlibfuzzer-sys = { path = \"../../libfuzzer\", default-features = false }\n```\n\nThen link to your own runtime in your `build.rs`.\n\n## Updating libfuzzer from upstream\n\n* Update the `COMMIT=...` variable in `./update-libfuzzer.sh` with the new\n  commit hash from [llvm-mirror/llvm-project](github.com/llvm-mirror/llvm-project)\n  that you are vendoring.\n\n* Re-run the script:\n\n  ```\n  $ ./update-libfuzzer.sh \u003cgithub.com/llvm-mirror/llvm-project SHA1\u003e\n  ```\n\n## License\n\nAll files in the `libfuzzer` directory are licensed NCSA.\n\nEverything else is dual-licensed Apache 2.0 and MIT.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-fuzz%2Flibfuzzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-fuzz%2Flibfuzzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-fuzz%2Flibfuzzer/lists"}