Thank you for your interest in contributing. This document covers the workflow, code style, and testing requirements for all contributions.
When reporting a bug, include:
- Architecture and binary: what you were analyzing (e.g., x86-64 ELF)
- Command: the exact radare2 or CLI command that failed
- Expected vs actual output: what you expected and what you got
- Version info: output of
r2 -vandcargo --version
For crashes, include a backtrace if possible:
RUST_BACKTRACE=1 r2 -qc 'aaa; s main; a:sla.dec' /path/to/binary- Fork the repository
- Create a feature branch:
git checkout -b feature/my-change - Make your changes
- Add tests (see Testing Requirements below)
- Run the full test suite:
cargo test --all-features cd tests/e2e && cargo test
- Open a pull request
Use short, descriptive commit messages. Prefix with the affected component:
r2il: add FloatCompare opcode
r2ssa: fix phi placement for switch blocks
r2dec: improve for-loop detection heuristic
plugin: add a:sla.newcmd command
tests: add e2e test for taint analysis
docs: update ESIL translation table
- First line: imperative mood, max 72 characters
- Body (optional): explain why, not what
The project uses Rust edition 2024.
- Use
thiserrorfor error types - Return
Result<T, E>from fallible functions, notpanic! - Use
anyhowonly in tests and CLI, not in library crates
- Types:
PascalCase - Functions/methods:
snake_case - Constants:
SCREAMING_SNAKE_CASE - Feature flags: lowercase with hyphens (
all-archs)
cargo fmt --all
cargo clippy --all-features -- -D warnings- Use
#[unsafe(no_mangle)]instead of#[no_mangle] - Use
unsafe { ... }blocks insideunsafe fnbodies
format!()over string concatenationmatches!()over verbosematchwithtrue/falsearms- Exhaustive
matchover_ =>catch-all when feasible - Small, focused functions over large monoliths
All new features must have tests. This is enforced during review.
| Change type | Required test |
|---|---|
| New opcode | Unit test in crate + e2e test via a:sla.json |
| New plugin command | e2e test in tests/e2e/integration_tests.rs |
| New optimization pass | Unit test in r2ssa + e2e test via a:sla.ssa.func.opt |
| Bug fix | Regression test reproducing the bug |
| Decompiler change | e2e test via a:sla.dec |
If your change needs a specific binary pattern to exercise:
- Add a function to
tests/e2e/vuln_test.c - Add it to the
main()switch - Recompile:
gcc -O0 -g -fno-stack-protector -no-pie -o vuln_test vuln_test.c
See doc/testing.md for the full guide.
# Unit tests
cargo test --all-features
# Integration tests
cd tests/e2e
cargo test
# Specific test
cd tests/e2e
cargo test test_taint_analysisBefore submitting a PR, confirm:
-
cargo build --all-featuressucceeds -
cargo test --all-featurespasses -
cargo clippy --all-features -- -D warningsis clean -
cd tests/e2e && cargo testpasses (if plugin-related) - New features have tests
- Commit messages follow the style above
- Documentation updated if needed (doc/, AGENTS.md)
All PRs are reviewed before merging. Reviewers will check:
- Correctness (does it do what it claims?)
- Test coverage (are edge cases handled?)
- Style consistency (does it match the codebase?)
- Performance (does it avoid unnecessary allocations or O(n^2) patterns?)
By contributing, you agree that your contributions are licensed under the LGPL-3.0-only license, matching the project.