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

index out of bounds #9

Closed
amotmot opened this issue Dec 3, 2019 · 5 comments
Closed

index out of bounds #9

amotmot opened this issue Dec 3, 2019 · 5 comments

Comments

@amotmot
Copy link

amotmot commented Dec 3, 2019

I've encountered an index out of bounds panic with cargo 1.39.0.

[Nettfiske] 🔍   Fetching Certificates ...
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /private/tmp/rust-20191107-43598-2ji78o/rustc-1.39.0-src/src/libcore/slice/mod.rs:2717:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[Nettfiske] 🔍   Fetching Certificates ...
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /private/tmp/rust-20191107-43598-2ji78o/rustc-1.39.0-src/src/libcore/slice/mod.rs:2717:10
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::panicking::panic_bounds_check
  10: nettfiske::nettfiske::Nettfiske::analyse_domain
  11: <nettfiske::WebSocketHandler as nettfiske::websockets::EventHandler>::on_data_event
  12: nettfiske::websockets::WebSockets::event_loop
  13: nettfiske::main
  14: std::rt::lang_start::{{closure}}
  15: std::panicking::try::do_call
  16: __rust_maybe_catch_panic
  17: std::rt::lang_start_internal
  18: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@ollivera
Copy link

ollivera commented Dec 4, 2019

@gbedoya I tested with Rust 1.39 and I am not able to reproduce it. Does it happen every time you run it?

Please try the commands below:

cargo clean
cargo update
cargo run --release sample.json

I do not get the panic but I noticed the error below in the nettfiske.log file, so I will investigate

[2019-12-04][17:19:10] Received unknown message: invalid type: null, expected a string at line 1 column 14112
[2019-12-04][17:19:10] Received unknown message: invalid type: null, expected a string at line 1 column 13827
[2019-12-04][17:19:11] Received unknown message: invalid type: null, expected a string at line 1 column 14112
[2019-12-04][17:19:38] Error setting UP log: logging initialization failed: attempted to set a logger after the logging system was already initialized

@wisespace-io
Copy link
Owner

@gbedoya I fixed two problems, the error message in the log and the error you reported. Thank you for reporting. Please try the latest version and let me know if it is still a problem

@amotmot
Copy link
Author

amotmot commented Dec 5, 2019

@wisespace-io I'm having success with the provided sample.json after the cargo clean & update. However, when I run with ...

{
    "identities" : [
        {
            "common_name": "[REDACTED]"
        }
    ]
}

Output:

➜  nettfiske git:(master) ✗ cargo run --release sample.json
    Finished release [optimized] target(s) in 0.32s
     Running `target/release/nettfiske sample.json`
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
[Nettfiske] 🔍   Fetching Certificates ...
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /private/tmp/rust-20191107-43598-2ji78o/rustc-1.39.0-src/src/libcore/slice/mod.rs:2717:10
stack backtrace:
   0:        0x1035e0a25 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h544524a7cfcf45ac
   1:        0x103603351 - core::fmt::write::hde250ead077e2b4e
   2:        0x1035ee519 - std::io::Write::write_fmt::ha9661be3deb7aad2
   3:        0x1035e20ca - std::panicking::default_hook::{{closure}}::h3c4469e572d8fcea
   4:        0x1035e1e1f - std::panicking::default_hook::h244274cbfa0d3cb9
   5:        0x1035e2787 - std::panicking::rust_panic_with_hook::h1cc1b91b6800db27
   6:        0x1035e22fd - std::panicking::continue_panic_fmt::h851031a5cf31ba4c
   7:        0x1035e2259 - rust_begin_unwind
   8:        0x1036104af - core::panicking::panic_fmt::hf9d97a028b885d64
   9:        0x103610469 - core::panicking::panic_bounds_check::hf2b25cfb2f847acf
  10:        0x10349cbc8 - nettfiske::nettfiske::Nettfiske::analyse_domain::hd95a176afb04a779
  11:        0x103495da7 - <nettfiske::WebSocketHandler as nettfiske::websockets::EventHandler>::on_data_event::hc71149df536e2553
  12:        0x103483749 - nettfiske::websockets::WebSockets::event_loop::h8abb8288feb13e5e
  13:        0x103496da4 - nettfiske::main::h806cbf61d653a634
  14:        0x1034a2886 - std::rt::lang_start::{{closure}}::h299c326dcec4af27
  15:        0x1035e21e8 - std::panicking::try::do_call::h3aa3549642d783df
  16:        0x1035f095f - __rust_maybe_catch_panic
  17:        0x1035e6d53 - std::rt::lang_start_internal::h6a69b9e068efe0c5
  18:        0x1034975e9 - main

@wisespace-io
Copy link
Owner

@gbedoya Have you tried the latest version? Please check if it is version "0.2.4" in the Cargo.toml as the "Index Out of bounds" error should be fixed by now. If you cloned the repository do a

git fetch
git pull

You can also download the latest from https://github.com/wisespace-io/nettfiske/releases

I tried with the suggested sample and it ran for two hours without any "Index out of bounds" error.

{
    "identities" : [
        {
            "common_name": "garmin"
        }
    ]
}

@amotmot
Copy link
Author

amotmot commented Dec 5, 2019

@wisespace-io Grabbed the latest version and all is well. The performance provided by Rust is obvious compared to similar projects and makes this project stand out. Thanks.

@amotmot amotmot closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants