Skip to content

Commit

Permalink
Improve ruff_parse_simple to find UTF-8 violations (#5008)
Browse files Browse the repository at this point in the history
Improves the `ruff_parse_simple` fuzz harness by adding checks for
parsed locations to ensure they all lie on UTF-8 character boundaries.
This will allow for faster identification of issues like #5004.

This also adds additional details for Apple M1 users and clarifies the
importance of using `init-fuzzer.sh` (thanks for the feedback,
@jasikpark 🙂).
  • Loading branch information
addisoncrump authored Jun 12, 2023
1 parent 9db622a commit 70e6c21
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1,976 deletions.
1 change: 1 addition & 0 deletions crates/ruff_python_ast/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub use crate::node::AstNode;
pub use rustpython_ast::*;
pub use rustpython_parser::*;
2 changes: 1 addition & 1 deletion crates/ruff_python_ast/src/source_code/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl<'a> Generator<'a> {
self.buffer
}

pub(crate) fn unparse_suite<U>(&mut self, suite: &Suite<U>) {
pub fn unparse_suite<U>(&mut self, suite: &Suite<U>) {
for stmt in suite {
self.unparse_stmt(stmt);
}
Expand Down
1 change: 1 addition & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
artifacts/
corpus/ruff_fix_validity
Cargo.lock
Loading

0 comments on commit 70e6c21

Please sign in to comment.