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

Parser fuzz testing tools and fixes #185

Merged
merged 1 commit into from
Jan 25, 2023
Merged

Parser fuzz testing tools and fixes #185

merged 1 commit into from
Jan 25, 2023

Conversation

c42f
Copy link
Member

@c42f c42f commented Jan 24, 2023

Some fuzz testing tooling to check that the parser doesn't crash on randomly generated source strings.

Fix several problems found with this:

  • ? shouldn't be special in parse_unary. This was inherited from the a syntax hack used to support the ancient and questionable @windows? and other platform test macros in osutils.jl. This is long since gone and we shouldn't continue supporting this.
  • <: may be unary so <: <: x should parse as (<: (<: x)), even though this is kind of nonsense semantically.
  • Constructing a SyntaxNode tree shouldn't fail when there's malformed literals but when we've parsed using ignore_errors=true. Instead we use ErrorVal() for the leaf values in that tree.
  • The tokenizer should not crash when overlong UTF-8 character literals are encountered.

Some fuzz testing tooling to check that the parser doesn't crash on
randomly generated source strings.

Fix several problems found with this:

* `?` shouldn't be special in `parse_unary`. This was inherited from the
  a syntax hack used to support the ancient and questionable `@windows?`
  and other platform test macros in osutils.jl. This is long since gone
  and we shouldn't continue supporting this.
* `<:` may be unary so `<: <: x` should parse as `(<: (<: x))`, even
  though this is kind of nonsense semantically.
* Constructing a SyntaxNode tree shouldn't fail when there's malformed
  literals but when we've parsed using `ignore_errors=true`. Instead we
  use ErrorVal() for the leaf values in that tree.
* The tokenizer should not crash when overlong UTF-8 character literals
  are encountered.
@c42f c42f mentioned this pull request Jan 24, 2023
9 tasks
@c42f c42f merged commit 1e12afe into main Jan 25, 2023
@c42f c42f deleted the c42f/fuzz-test-fixes branch January 25, 2023 08:04
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.

1 participant