Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzer support #3507

Closed
qarmin opened this issue Mar 14, 2023 · 1 comment
Closed

Fuzzer support #3507

qarmin opened this issue Mar 14, 2023 · 1 comment
Labels
internal An internal refactor or improvement

Comments

@qarmin
Copy link

qarmin commented Mar 14, 2023

Recently I tried to create simple automatic fuzzer to test project to find crashes/leaks but I got few problems.

Current patch (feel free to take it, fix/modify and create PR) - 0002-Ruff-fuzzer.patch.txt

  • lint_stdin is not available from outside of module (pub mod diagnostics; fixes it)
  • Cannot easy create settings with all available rules enabled - for testing purposes I enabled for_rules constructor for non test builds and I set there random one rule
  • Looks that lint_stdin finds different problems that default ruff command(probably lint_path).
    When testing, after a while(fuzzer need to start to test longer inputs) I see in terminal messages
error: Failed to converge after 100 iterations.

This indicates a bug in `ruff`. If you could open an issue at:

    https://github.com/charliermarsh/ruff/issues/new?title=%5BInfinite%20loop%5D

...quoting the contents of `-`, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

but when I check file with ruff 256274.py --fix(256274.py.zip) command, then I got parse error message

error: Failed to parse pp/256274.py: invalid syntax. Got unexpected token ';' at line 1 column 7

I already used fuzzer to minimize test case from #3425, so I can confirm that it works(at least partially)

After applying patch, to run fuzzer you need to run this commands

cargo install cargo-fuzz
cd ruff
cargo +nightly fuzz run fuzz_target_1
@charliermarsh
Copy link
Member

We added fuzzer support recently (#4822).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

No branches or pull requests

2 participants