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 index out of bounds with new no_absolute_path rule #9495

Closed
qarmin opened this issue Mar 3, 2025 · 0 comments · Fixed by #9500
Closed

Panic index out of bounds with new no_absolute_path rule #9495

qarmin opened this issue Mar 3, 2025 · 0 comments · Fixed by #9500
Labels
C-bug Category - Bug

Comments

@qarmin
Copy link

qarmin commented Mar 3, 2025

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):

require()

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 --fix-suggestions --fix-dangerously

cause this


thread '<unnamed>' panicked at crates/oxc_linter/src/rules/import/no_absolute_path.rs:126:47:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_bounds_check
             at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library/core/src/panicking.rs:273:5
   3: <usize as core::slice::index::SliceIndex<[T]>>::index
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:274:10
   4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:16:15
   5: <allocator_api2::stable::vec::Vec<T,A> as core::ops::index::Index<I>>::index
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/allocator-api2-0.2.21/src/stable/vec/mod.rs:2617:9
   6: <oxc_allocator::vec::Vec<T> as core::ops::index::Index<I>>::index
             at ./oxc-main/crates/oxc_allocator/src/vec.rs:263:16
   7: <oxc_linter::rules::import::no_absolute_path::NoAbsolutePath as oxc_linter::rule::Rule>::run
             at ./oxc-main/crates/oxc_linter/src/rules/import/no_absolute_path.rs:126:47
   8: oxc_linter::Linter::run
             at ./oxc-main/crates/oxc_linter/src/lib.rs:195:21
   9: oxc_linter::service::runtime::Runtime::process_source
             at ./oxc-main/crates/oxc_linter/src/service/runtime.rs:275:9
  10: oxc_linter::service::runtime::Runtime::process_path
             at ./oxc-main/crates/oxc_linter/src/service/runtime.rs:154:32
  11: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter::with::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:317:22
  12: core::iter::adapters::map::map_fold::{{closure}}
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28
  13: core::iter::traits::iterator::Iterator::fold
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2546:21
  14: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:9
  15: core::iter::traits::iterator::Iterator::for_each
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:800:9
  16: <rayon::iter::noop::NoopConsumer as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/noop.rs:34:9
  17: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:322:25
  18: rayon::iter::plumbing::Producer::fold_with
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  19: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  20: rayon::iter::plumbing::bridge_producer_consumer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  21: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  22: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:147:13
  23: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:83:9
  24: rayon::iter::plumbing::bridge
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  25: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:58:9
  26: <rayon::collections::hash_set::Iter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/delegate.rs:21:28
  27: <rayon::iter::map_with::MapWith<I,T,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:53:9
  28: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<()> for ()>::from_par_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/from_par_iter.rs:308:9
  29: rayon::iter::ParallelIterator::collect
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/mod.rs:2069:9
  30: rayon::iter::ParallelIterator::for_each_with
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/mod.rs:417:33
  31: oxc_linter::service::LintService::run
             at ./oxc-main/crates/oxc_linter/src/service/mod.rs:95:14
  32: <oxlint::lint::LintRunner as oxlint::runner::Runner>::run::{{closure}}
             at ./oxc-main/apps/oxlint/src/lint.rs:334:17
  33: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  34: std::panicking::try::do_call
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  35: std::panicking::try
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  36: std::panic::catch_unwind
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  37: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/unwind.rs:17:5
  38: rayon_core::registry::Registry::catch_unwind
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:367:27
  39: rayon_core::spawn::spawn_job::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/spawn/mod.rs:97:13
  40: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/job.rs:169:9
  41: rayon_core::job::JobRef::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/job.rs:64:9
  42: rayon_core::registry::WorkerThread::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:860:13
  43: rayon_core::registry::WorkerThread::wait_until_cold
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:794:26
  44: rayon_core::registry::WorkerThread::wait_until
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:769:13
  45: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:818:9
  46: rayon_core::registry::main_loop
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:923:5
  47: rayon_core::registry::ThreadBuilder::run
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:53:18
  48: <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/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

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