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

check panics on example 01 with JSON output #378

Closed
dnaka91 opened this issue Nov 22, 2021 · 1 comment · Fixed by #379
Closed

check panics on example 01 with JSON output #378

dnaka91 opened this issue Nov 22, 2021 · 1 comment · Fixed by #379
Labels
bug Something isn't working

Comments

@dnaka91
Copy link
Contributor

dnaka91 commented Nov 22, 2021

Describe the bug
When running cargo-deny with -f json on the 01_allow_license in this repository, the application panics.

The exact error I get is:

thread '<unnamed>' panicked at 'byte index 44 is out of bounds of `[licenses]
allow = [ "MIT" ]
`', /Users/***/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-deny-0.10.2/src/diag/obj_grapher.rs:150:30
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::str::slice_error_fail
   3: cargo_deny::diag::obj_grapher::cs_diag_to_json
   4: cargo_deny::diag::obj_grapher::diag_to_json
   5: cargo_deny::common::OutputLock::print_krate_diag
   6: cargo_deny::check::print_diagnostics
   7: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
   8: rayon_core::registry::WorkerThread::wait_until_cold
   9: rayon_core::registry::ThreadBuilder::run

To Reproduce

  1. Install latest cargo-deny (cargo install cargo-deny).
  2. Clone the cargo-deny repository.
  3. Go to the examples/01_allow_license subfolder.
  4. Run cargo-deny with JSON output (cargo deny -f json check)
  5. cargo-deny panics with an out of bounds error

Expected behavior
cargo-deny shouldn't panic and instead produce the expected JSON output.

Device:

  • OS: MacOS
  • Version: 11.6.1
@dnaka91
Copy link
Contributor Author

dnaka91 commented Nov 22, 2021

Thanks for the quick fix 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant