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 byte index 7 is not a char boundary in oxc_span/src/span/mod.rs #4887

Closed
qarmin opened this issue Aug 14, 2024 · 1 comment · Fixed by #5582
Closed

Panic byte index 7 is not a char boundary in oxc_span/src/span/mod.rs #4887

qarmin opened this issue Aug 14, 2024 · 1 comment · Fixed by #5582
Assignees
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers

Comments

@qarmin
Copy link

qarmin commented Aug 14, 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):

let[f, a]=p

command

timeout -v 100 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_span/src/span/mod.rs:315:21:
byte index 7 is not a char boundary; it is inside '\u{a0}' (bytes 6..8) of `let[f, a]=p`
stack backtrace:
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 Aug 14, 2024
@camc314
Copy link
Contributor

camc314 commented Aug 14, 2024

stack trace:

byte index 7 is not a char boundary; it is inside '\u{a0}' (bytes 6..8) of `let[f, a]=p`
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::str::slice_error_fail_rt
   3: core::str::slice_error_fail
   4: core::str::traits::<impl core::slice::index::SliceIndex<str> for core::ops::range::Range<usize>>::index
   5: core::str::traits::<impl core::ops::index::Index<I> for str>::index
   6: oxc_span::span::<impl oxc_span::span::types::Span>::source_text
   7: oxc_linter::context::LintContext::source_range
   8: oxc_linter::fixer::RuleFixer::possibly_truncate_range
   9: oxc_linter::fixer::RuleFixer::replace
  10: oxc_linter::rules::eslint::no_unused_vars::fixers::<impl oxc_linter::rules::eslint::no_unused_vars::NoUnusedVars>::rename_or_remove_var_declaration
  11: oxc_linter::rules::eslint::no_unused_vars::NoUnusedVars::run_on_symbol_internal::{{closure}}
  12: oxc_linter::context::LintContext::diagnostic_with_fix_of_kind
  13: oxc_linter::context::LintContext::diagnostic_with_suggestion
  14: oxc_linter::rules::eslint::no_unused_vars::NoUnusedVars::run_on_symbol_internal
  15: <oxc_linter::rules::eslint::no_unused_vars::NoUnusedVars as oxc_linter::rule::Rule>::run_on_symbol
  16: oxc_linter::rules::RuleEnum::run_on_symbol
  17: oxc_linter::Linter::run
  18: oxc_linter::service::Runtime::process_source
  19: oxc_linter::service::Runtime::process_path
  20: oxc_linter::service::LintService::run::{{closure}}
  21: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume
  22: <&rayon::iter::par_bridge::IterParallelProducer<Iter> as rayon::iter::plumbing::UnindexedProducer>::fold_with
  23: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  24: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
  25: rayon_core::join::join_context::call_a::{{closure}}
  26: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  27: std::panicking::try::do_call
  28: ___rust_try
  29: std::panicking::try
  30: std::panic::catch_unwind
  31: rayon_core::unwind::halt_unwinding
  32: rayon_core::join::join_context::{{closure}}
  33: rayon_core::registry::in_worker
  34: rayon_core::join::join_context
  35: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  36: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
  37: rayon_core::join::join_context::call_a::{{closure}}
  38: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  39: std::panicking::try::do_call
  40: ___rust_try
  41: std::panicking::try
  42: std::panic::catch_unwind
  43: rayon_core::unwind::halt_unwinding
  44: rayon_core::join::join_context::{{closure}}
  45: rayon_core::registry::in_worker
  46: rayon_core::join::join_context
  47: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  48: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
  49: rayon_core::join::join_context::call_a::{{closure}}
  50: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  51: std::panicking::try::do_call
  52: ___rust_try
  53: std::panicking::try
  54: std::panic::catch_unwind
  55: rayon_core::unwind::halt_unwinding
  56: rayon_core::join::join_context::{{closure}}
  57: rayon_core::registry::in_worker
  58: rayon_core::join::join_context
  59: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  60: rayon::iter::plumbing::bridge_unindexed_producer_consumer::{{closure}}
  61: rayon_core::join::join_context::call_a::{{closure}}
  62: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  63: std::panicking::try::do_call
  64: ___rust_try
  65: std::panicking::try
  66: std::panic::catch_unwind
  67: rayon_core::unwind::halt_unwinding
  68: rayon_core::join::join_context::{{closure}}
  69: rayon_core::registry::in_worker
  70: rayon_core::join::join_context
  71: rayon::iter::plumbing::bridge_unindexed_producer_consumer
  72: rayon::iter::plumbing::bridge_unindexed
  73: <rayon::iter::par_bridge::IterBridge<Iter> as rayon::iter::ParallelIterator>::drive_unindexed
  74: <rayon::iter::map_with::MapWith<I,T,F> as rayon::iter::ParallelIterator>::drive_unindexed
  75: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<()> for ()>::from_par_iter
  76: rayon::iter::ParallelIterator::collect
  77: rayon::iter::ParallelIterator::for_each_with
  78: oxc_linter::service::LintService::run
  79: <oxlint::lint::LintRunner as oxlint::runner::Runner>::run::{{closure}}
  80: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  81: std::panicking::try::do_call
  82: ___rust_try
  83: std::panicking::try
  84: std::panic::catch_unwind
  85: rayon_core::unwind::halt_unwinding
  86: rayon_core::registry::Registry::catch_unwind
  87: rayon_core::spawn::spawn_job::{{closure}}
  88: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
  89: rayon_core::job::JobRef::execute
  90: rayon_core::registry::WorkerThread::execute
  91: rayon_core::registry::WorkerThread::wait_until_cold
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Rayon: detected unexpected panic; aborting
zsh: abort      RUST_BACKTRACE=1 ./target/debug/oxlint -D all -D nursery --import-plugin   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants