drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pick index out of range, oob access

drahnr opened this issue · comments

Describe the bug

Segmentation fault when cargo spellcheck --checker=hunspell fix

To Reproduce

Steps to reproduce the behaviour:

  1. A file containing rust code
  2. Run cargo spellcheck --checker=hunspell fix
  3. Select a suggestion
error: spellcheck(Hunspell)
    --> /media/supersonic1t/projects/parity/polkadot-bernhard-inherent-filtering/runtime/parachains/src/paras_inherent.rs:280
     |
 280 |  The paramter `freed_concluded` contains all core indicies that became
     |      ^^^^^^^^

(1/4) Apply this suggestion [y,n,q,a,d,j,e,?]?

 » parameter
   `paramter`
The application panicked (crashed).
Message:  User Pick index is out of bounds
Location: src/action/interactive.rs:159

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮                               
   8: core::option::expect_failed::h125bbd9bf2aa8dad
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:1615
   9: core::option::Option<T>::expect::h8421c4550fbeaf6a
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:698
  10: cargo_spellcheck::action::interactive::State::to_bandaid::hbfd25b4ac7edd45e
      at /media/supersonic1t/projects/cargo-spellcheck/src/action/interactive.rs:155
  11: cargo_spellcheck::action::interactive::UserPicked::user_input::he083ec50dd46e34f
      at /media/supersonic1t/projects/cargo-spellcheck/src/action/interactive.rs:449
  12: cargo_spellcheck::action::interactive::UserPicked::select_interactive::h131e01d67338a264
      at /media/supersonic1t/projects/cargo-spellcheck/src/action/interactive.rs:517
  13: cargo_spellcheck::action::Action::run_fix_interactive::{{closure}}::h4f3c20ab44c22cda
      at /media/supersonic1t/projects/cargo-spellcheck/src/action/mod.rs:377
  14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h8ff3216a821b12a6
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80
  15: cargo_spellcheck::action::Action::run::{{closure}}::h24eb865d83232c8e
      at /media/supersonic1t/projects/cargo-spellcheck/src/action/mod.rs:343
  16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hdea043909938fb03
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80
  17: cargo_spellcheck::run::{{closure}}::hf04e843739991db4
      at /media/supersonic1t/projects/cargo-spellcheck/src/main.rs:174
  18: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h253c15ca53125900
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80
  19: tokio::park::thread::CachedParkThread::block_on::{{closure}}::h4b8ca24124b2e598
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/park/thread.rs:263
  20: tokio::coop::with_budget::{{closure}}::hb1a46ea9a31f67ab
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:106
  21: std::thread::local::LocalKey<T>::try_with::hac2eea7c0cbae295
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399
  22: std::thread::local::LocalKey<T>::with::h6e68fcdf32addb51
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375
  23: tokio::coop::with_budget::he0ebe05f6daa15cb
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:99
  24: tokio::coop::budget::hcdfdb9d40d4144f4
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:76
  25: tokio::park::thread::CachedParkThread::block_on::h4a8ac1f4349c581d
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/park/thread.rs:263
  26: tokio::runtime::enter::Enter::block_on::hc06d6966b04fad1b
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/enter.rs:151
  27: tokio::runtime::thread_pool::ThreadPool::block_on::ha899bfdfac6da116
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/mod.rs:77
  28: tokio::runtime::Runtime::block_on::h61b0b51f75324602
      at /home/bernhard/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/mod.rs:463
  29: cargo_spellcheck::run::h72eccf282b149b1e
      at /media/supersonic1t/projects/cargo-spellcheck/src/main.rs:174
  30: cargo_spellcheck::main::h509443d3570cb335
      at /media/supersonic1t/projects/cargo-spellcheck/src/main.rs:189
  31: core::ops::function::FnOnce::call_once::h6f2b1bbdfa6b88be
      at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227
                                ⋮ 15 frames hidden ⋮                              

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.

Expected behavior

Not crash

Screenshots

Please complete the following information:

  • System: Fedora 35
  • Obtained: git
  • Version: cargo-spellcheck 0.9.3-alpha.0

Additional context