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

test: basic fuzzing #407

Merged
merged 13 commits into from
Aug 9, 2024
Merged

test: basic fuzzing #407

merged 13 commits into from
Aug 9, 2024

Conversation

LeoDog896
Copy link
Contributor

Cryptic error messages are thrown on derive when parsing regex, and without backtraces, confusion about these errors appears like #389. This adds fuzzing with AFL, which immediately caught issue #389, amongst a few others I have yet to diagnose.

@jeertmans
Copy link
Collaborator

Hello @LeoDog896! I did some experiences with fuzzing Logos in the past, with no specific conclusion, so I didn't push any configuration to the main branch.

If we push a fuzzing configuration, we at least need some good motivation to keep it: the best would be to show that it helped to find an issue. Moreover, it would also be great to include some words about it in the book (or README) to help contributors understand how fuzzing works and why they should run it.

Otherwise, this is just going to be some pieces of code that will never be used :-/

@LeoDog896
Copy link
Contributor Author

LeoDog896 commented Jul 25, 2024

The fuzzing can indeed find issues that can help improve developer experience - it's not something that needs to be constantly run as the function currently being fuzzed isn't a function susceptible to user input (and I'm unsure of a strategy to fuzz the logos generation without it being painfully slow) but lots of people, from the issues, have trouble diagnosing the confusing error messages.

For example, \pz********************a(a(\, immediately found by the fuzzer, makes it to Merging two reserved nodes! This is a bug, please report it: when it shouldn't make it past the valid regex stage.

Copy link
Collaborator

@jeertmans jeertmans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Please look at my few comments :-)

book/src/contributing/fuzzing.md Outdated Show resolved Hide resolved
book/src/contributing/fuzzing.md Outdated Show resolved Hide resolved
book/src/contributing/fuzzing.md Outdated Show resolved Hide resolved
LeoDog896 and others added 3 commits August 7, 2024 11:10
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
@LeoDog896 LeoDog896 requested a review from jeertmans August 7, 2024 15:12
@jeertmans
Copy link
Collaborator

cargo msrv verify fails, so please run cargo msrv to find the new minimum support Rust version :-)

@jeertmans
Copy link
Collaborator

Thanks @LeoDog896!

@jeertmans jeertmans merged commit c51d4d3 into maciejhirsz:master Aug 9, 2024
18 checks passed
akrantz01 referenced this pull request in akrantz01/antsi Sep 19, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [logos](https://logos.maciej.codes/)
([source](https://github.com/maciejhirsz/logos)) | dependencies
| patch | `0.14.1` -> `0.14.2` |

---

### Release Notes

<details>
<summary>maciejhirsz/logos (logos)</summary>

###
[`v0.14.2`](https://github.com/maciejhirsz/logos/releases/tag/v0.14.2):
- Optional `forbid_unsafe` feature, fuzzing, book, and more!

[Compare
Source](https://github.com/maciejhirsz/logos/compare/v0.14.1...v0.14.2)

#### What's Changed

- chore(book): added link to Rust's reference by
[@&#8203;CommanderStorm](https://github.com/CommanderStorm) in
[https://github.com/maciejhirsz/logos/pull/411](https://github.com/maciejhirsz/logos/pull/411)
- feat: impl Source for T: Deref in no_std by
[@&#8203;yjhmelody](https://github.com/yjhmelody) in
[https://github.com/maciejhirsz/logos/pull/406](https://github.com/maciejhirsz/logos/pull/406)
- fix(codegen/regex): allow vec growth on parse by
[@&#8203;LeoDog896](https://github.com/LeoDog896) in
[https://github.com/maciejhirsz/logos/pull/405](https://github.com/maciejhirsz/logos/pull/405)
- test: basic fuzzing by
[@&#8203;LeoDog896](https://github.com/LeoDog896) in
[https://github.com/maciejhirsz/logos/pull/407](https://github.com/maciejhirsz/logos/pull/407)
- feat(lib): add `forbid_unsafe` feature to disable unsafe code by
[@&#8203;davidkern](https://github.com/davidkern) in
[https://github.com/maciejhirsz/logos/pull/413](https://github.com/maciejhirsz/logos/pull/413)
- chore(version): release v0.14.2 by
[@&#8203;jeertmans](https://github.com/jeertmans) in
[https://github.com/maciejhirsz/logos/pull/422](https://github.com/maciejhirsz/logos/pull/422)

#### New Contributors

- [@&#8203;CommanderStorm](https://github.com/CommanderStorm)
made their first contribution in
[https://github.com/maciejhirsz/logos/pull/411](https://github.com/maciejhirsz/logos/pull/411)
- [@&#8203;yjhmelody](https://github.com/yjhmelody) made their
first contribution in
[https://github.com/maciejhirsz/logos/pull/406](https://github.com/maciejhirsz/logos/pull/406)
- [@&#8203;davidkern](https://github.com/davidkern) made their
first contribution in
[https://github.com/maciejhirsz/logos/pull/413](https://github.com/maciejhirsz/logos/pull/413)

**Full Changelog**:
maciejhirsz/logos@v0.14.1...v0.14.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/akrantz01/antsi).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants