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

Panic inside crates/oxc_linter/src/rules/eslint/no_useless_escape.rs #6046

Closed
qarmin opened this issue Sep 24, 2024 · 1 comment · Fixed by #6048
Closed

Panic inside crates/oxc_linter/src/rules/eslint/no_useless_escape.rs #6046

qarmin opened this issue Sep 24, 2024 · 1 comment · Fixed by #6048
Assignees
Labels
C-bug Category - Bug

Comments

@qarmin
Copy link

qarmin commented Sep 24, 2024

File content(at the bottom should be attached raw, not formatted file - github removes some non-printable characters, so copying from here may not work):

/\c/

command

timeout -v 150 oxlint -D all -D nursery --import-plugin --jsdoc-plugin --jest-plugin --vitest-plugin --jsx-a11y-plugin --nextjs-plugin --react-perf-plugin TEST___FILE.js --fix

cause this

thread '<unnamed>' panicked at crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:198:48:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panicking.rs:74:14
   2: core::panicking::panic
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panicking.rs:148:5
   3: core::option::unwrap_failed
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/option.rs:2006:5
   4: core::option::Option<T>::unwrap
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/option.rs:969:21
   5: oxc_linter::rules::eslint::no_useless_escape::check_character
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:198:48
   6: oxc_linter::rules::eslint::no_useless_escape::check_pattern::{{closure}}
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:155:33
   7: oxc_linter::rules::eslint::no_useless_escape::visit_terms_alternative
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:408:18
   8: oxc_linter::rules::eslint::no_useless_escape::visit_terms_disjunction
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:372:9
   9: oxc_linter::rules::eslint::no_useless_escape::visit_terms
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:362:5
  10: oxc_linter::rules::eslint::no_useless_escape::check_pattern
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:146:5
  11: <oxc_linter::rules::eslint::no_useless_escape::NoUselessEscape as oxc_linter::rule::Rule>::run
             at ./oxc-main/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs:83:48
  12: oxc_linter::Linter::run
             at ./oxc-main/crates/oxc_linter/src/lib.rs:143:17
  13: oxc_linter::service::Runtime::process_source
             at ./oxc-main/crates/oxc_linter/src/service.rs:399:9
  14: oxc_linter::service::Runtime::process_path
             at ./oxc-main/crates/oxc_linter/src/service.rs:266:17
  15: oxc_linter::service::LintService::run::{{closure}}
             at ./oxc-main/crates/oxc_linter/src/service.rs:106:59
  16: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map_with.rs:304:27
  17: <&rayon::iter::par_bridge::IterParallelProducer<Iter> as rayon::iter::plumbing::UnindexedProducer>::fold_with
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/par_bridge.rs:145:30
  18: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  19: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:473:31
  20: rayon_core::join::join_context::call_a::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:124:17
  21: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panic/unwind_safe.rs:272:9
  22: std::panicking::try::do_call
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:557:40
  23: std::panicking::try
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:520:19
  24: std::panic::catch_unwind
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panic.rs:348:14
  25: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  26: rayon_core::join::join_context::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:142:24
  27: rayon_core::join::join_context
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:132:5
  28: rayon::iter::plumbing::bridge_unindexed_producer_consumer
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:472:51
  29: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:473:31
  30: rayon_core::join::join_context::call_a::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:124:17
  31: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panic/unwind_safe.rs:272:9
  32: std::panicking::try::do_call
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:557:40
  33: std::panicking::try
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:520:19
  34: std::panic::catch_unwind
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panic.rs:348:14
  35: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  36: rayon_core::join::join_context::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:142:24
  37: rayon_core::join::join_context
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:132:5
  38: rayon::iter::plumbing::bridge_unindexed_producer_consumer
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:472:51
  39: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:473:31
  40: rayon_core::join::join_context::call_a::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:124:17
  41: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panic/unwind_safe.rs:272:9
  42: std::panicking::try::do_call
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:557:40
  43: std::panicking::try
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:520:19
  44: std::panic::catch_unwind
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panic.rs:348:14
  45: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  46: rayon_core::join::join_context::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:142:24
  47: rayon_core::join::join_context
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/join/mod.rs:132:5
  48: rayon::iter::plumbing::bridge_unindexed_producer_consumer
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:472:51
  49: rayon::iter::plumbing::bridge_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:451:5
  50: <rayon::iter::par_bridge::IterBridge<Iter> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/par_bridge.rs:91:9
  51: <rayon::iter::map_with::MapWith<I,T,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/map_with.rs:53:9
  52: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<()> for ()>::from_par_iter
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/from_par_iter.rs:308:9
  53: rayon::iter::ParallelIterator::collect
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:2069:9
  54: rayon::iter::ParallelIterator::for_each_with
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:417:33
  55: oxc_linter::service::LintService::run
             at ./oxc-main/crates/oxc_linter/src/service.rs:106:14
  56: <oxlint::lint::LintRunner as oxlint::runner::Runner>::run::{{closure}}
             at ./oxc-main/apps/oxlint/src/lint/mod.rs:157:17
  57: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/core/src/panic/unwind_safe.rs:272:9
  58: std::panicking::try::do_call
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:557:40
  59: std::panicking::try
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panicking.rs:520:19
  60: std::panic::catch_unwind
             at /rustc/7042c269c166191cd5d8daf0409890903df7af57/library/std/src/panic.rs:348:14
  61: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/unwind.rs:17:5
  62: rayon_core::registry::Registry::catch_unwind
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:367:27
  63: rayon_core::spawn::spawn_job::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/spawn/mod.rs:97:13
  64: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:169:9
  65: rayon_core::job::JobRef::execute
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/job.rs:64:9
  66: rayon_core::registry::WorkerThread::execute
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:860:13
  67: rayon_core::registry::WorkerThread::wait_until_cold
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:794:26
  68: rayon_core::registry::WorkerThread::wait_until
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:769:13
  69: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:818:9
  70: rayon_core::registry::main_loop
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:923:5
  71: rayon_core::registry::ThreadBuilder::run
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:53:18
  72: <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-core-1.12.1/src/registry.rs:98:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

##### Automatic Fuzzer note, output status "None", output signal "Some(6)"

compressed.zip

@qarmin qarmin added the C-bug Category - Bug label Sep 24, 2024
@camchenry camchenry self-assigned this Sep 24, 2024
DonIsaac pushed a commit that referenced this issue Sep 24, 2024
…#6048)

Fixes #6046

Unlike other escape sequences such as `/\w/`, this is not actually parsed as a single character: `/\c/` so we incorrectly try to get the character before the backslash, which doesn't exist.
@camchenry
Copy link
Contributor

Should be fixed by #6048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants