Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Crash at @ character in class name / body #4669

Closed
1 task done
MahnurA opened this issue Jul 9, 2023 · 0 comments · Fixed by #4677
Closed
1 task done

🐛 Crash at @ character in class name / body #4669

MahnurA opened this issue Jul 9, 2023 · 0 comments · Fixed by #4677
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@MahnurA
Copy link

MahnurA commented Jul 9, 2023

Environment information

Cannot run rome rage, issue found by fuzzer.

**Additional Context**: 
Discovered by: Implement round-trip fuzzers for finding correctness bugs [#4559](https://github.com/rome/tools/pull/4559)

What happened?

The following cases crash with the thread '<unnamed>' panicked at 'assertion failed: modifiers.is_empty()', /rome/tools/crates/rome_js_parser/src/syntax/class.rs:567:13:

class C {
	@decorator
	}
 class C { 
	@
	}
  1. class @
  2. class C@

I suspect there are actually two bugs here:

  1. That the class name is not flagged as invalid if there is an invalid class name containing the @ sign
  2. If encounters an @ sign as the first character when calling a class member - crashes. Calling a decorator on nothing within a class results in an unhandled crash, i.e. not categorized as an invalid decorated class member.

Affected formatters:
rome_format_d_ts
rome_format_jsx
rome_format_module
rome_format_script
rome_format_tsx
rome_format_typescript

Expected result

Formatters should not crash.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant