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

thread 'main' panicked at 'called Result::unwrap() on an Err value: InvalidSignature', src/main.rs:583:48 #7

Closed
sijinglim opened this issue Feb 23, 2021 · 3 comments

Comments

@sijinglim
Copy link

Hi, sorry for the title text vomit, didn't really know what to put as title.

I cloned this repo and tried running cargo run test.png in two environments (Windows 10 x64, WSL1) and they both fail with a similar error.

Rust 1.50.0

With the Windows 10 x64:

warning: function is never used: `dot_matrix_print`
   --> src\main.rs:501:4
    |
501 | fn dot_matrix_print(buf: Vec<Vec<u8>>) {
    |    ^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.32s
     Running `target\debug\img2utf.exe test.png`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidSignature', src\main.rs:583:48
stack backtrace:
   0:     0x7ff7e998ec0e - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff7e998ec0e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff7e998ec0e - std::sys_common::backtrace::_print_fmt
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff7e998ec0e - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff7e999e08b - core::fmt::write
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\core\src\fmt\mod.rs:1078
   5:     0x7ff7e998c288 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\io\mod.rs:1517
   6:     0x7ff7e99915ed - std::sys_common::backtrace::_print
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff7e99915ed - std::sys_common::backtrace::print
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff7e99915ed - std::panicking::default_hook::{{closure}}
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:208
   9:     0x7ff7e9991054 - std::panicking::default_hook
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:225
  10:     0x7ff7e9991efe - std::panicking::rust_panic_with_hook
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:591
  11:     0x7ff7e9991a21 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:497
  12:     0x7ff7e998f56f - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff7e9991979 - std::panicking::begin_panic_handler
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:493
  14:     0x7ff7e999d3b0 - core::panicking::panic_fmt
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\core\src\panicking.rs:92
  15:     0x7ff7e999d1d3 - core::option::expect_none_failed
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\core\src\option.rs:1268
  16:     0x7ff7e99316c8 - core::result::Result<tuple<png::decoder::OutputInfo, png::decoder::Reader<std::fs::File>>, png::decoder::stream::DecodingError>::unwrap<tuple<png::decoder::OutputInfo, png::decoder::Reader<std::fs::File>>,png::decoder::stream::DecodingError>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\core\src\result.rs:973
  17:     0x7ff7e993f8e3 - img2utf::main
                               at C:\Users\username\Documents\tmp\img2utf\src\main.rs:583
  18:     0x7ff7e993ce1b - core::ops::function::FnOnce::call_once<fn(),tuple<>>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\core\src\ops\function.rs:227
  19:     0x7ff7e993304b - std::sys_common::backtrace::__rust_begin_short_backtrace<fn(),tuple<>>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\std\src\sys_common\backtrace.rs:125
  20:     0x7ff7e993e051 - std::rt::lang_start::{{closure}}<tuple<>>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\std\src\rt.rs:66
  21:     0x7ff7e99920b4 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\core\src\ops\function.rs:280
  22:     0x7ff7e99920b4 - std::panicking::try::do_call
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:379
  23:     0x7ff7e99920b4 - std::panicking::try
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panicking.rs:343
  24:     0x7ff7e99920b4 - std::panic::catch_unwind
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\panic.rs:396
  25:     0x7ff7e99920b4 - std::rt::lang_start_internal
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\/library\std\src\rt.rs:51
  26:     0x7ff7e993e023 - std::rt::lang_start<tuple<>>
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\library\std\src\rt.rs:65
  27:     0x7ff7e993fb30 - main
  28:     0x7ff7e99a2c20 - invoke_main
                               at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  29:     0x7ff7e99a2c20 - __scrt_common_main_seh
                               at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  30:     0x7ff9ff087c24 - BaseThreadInitThunk
  31:     0x7ff9ffc4d4d1 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\img2utf.exe test.png` (exit code: 101)

Through WSL:

warning: function is never used: `dot_matrix_print`
   --> src/main.rs:501:4
    |
501 | fn dot_matrix_print(buf: Vec<Vec<u8>>) {
    |    ^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/img2utf test.png`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidSignature', src/main.rs:583:48
stack backtrace:
   0:     0x7f663b87c060 - std::backtrace_rs::backtrace::libunwind::trace::h25e12e0d899beba0
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f663b87c060 - std::backtrace_rs::backtrace::trace_unsynchronized::h70e61195d6ae3df6
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f663b87c060 - std::sys_common::backtrace::_print_fmt::hba93ab80d779695a
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f663b87c060 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf092b5883b4b2e50
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f663b89346c - core::fmt::write::hf68bc350a8f2f0dc
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f663b87a122 - std::io::Write::write_fmt::hf66811b1bc767436
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/io/mod.rs:1517:15
   6:     0x7f663b87dd95 - std::sys_common::backtrace::_print::hd425a11bfe1f20f8
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f663b87dd95 - std::sys_common::backtrace::print::h6d678795c1e61e13
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f663b87dd95 - std::panicking::default_hook::{{closure}}::h78a02a4a0dee5e7e
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:208:50
   9:     0x7f663b87d8ea - std::panicking::default_hook::h56eb7eda02f355a7
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:225:9
  10:     0x7f663b87e531 - std::panicking::rust_panic_with_hook::hb27ea14285131c61
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:591:17
  11:     0x7f663b87e077 - std::panicking::begin_panic_handler::{{closure}}::hc552fcee62aad17f
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:497:13
  12:     0x7f663b87c51c - std::sys_common::backtrace::__rust_end_short_backtrace::hb9f0aa9a78e885a0
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x7f663b87dfd9 - rust_begin_unwind
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
  14:     0x7f663b892841 - core::panicking::panic_fmt::h12ac4570ea43d06f
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
  15:     0x7f663b892663 - core::option::expect_none_failed::h096fa60f757b7204
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/option.rs:1268:5
  16:     0x7f663b8169b9 - core::result::Result<T,E>::unwrap::he717d09f46cf7124
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/result.rs:973:23
  17:     0x7f663b8183ac - img2utf::main::h2d10a581b9a7a49e
                               at /mnt/c/Users/username/Documents/tmp/img2utf/src/main.rs:583:28
  18:     0x7f663b81894b - core::ops::function::FnOnce::call_once::h69bfc6e9f0400879
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/ops/function.rs:227:5
  19:     0x7f663b80e44e - std::sys_common::backtrace::__rust_begin_short_backtrace::he847f0c16ad7cc83
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:125:18
  20:     0x7f663b80d8d1 - std::rt::lang_start::{{closure}}::hceacd7c73b5f22de
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/rt.rs:66:18
  21:     0x7f663b87e957 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h78040f802d89ccdc
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/ops/function.rs:259:13
  22:     0x7f663b87e957 - std::panicking::try::do_call::h6853cad536dd09a1
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:379:40
  23:     0x7f663b87e957 - std::panicking::try::h827495f03a9fbb9a
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:343:19
  24:     0x7f663b87e957 - std::panic::catch_unwind::h4bdf17571090eb17
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panic.rs:396:14
  25:     0x7f663b87e957 - std::rt::lang_start_internal::h2f319c33bb013f29
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/rt.rs:51:25
  26:     0x7f663b80d8a7 - std::rt::lang_start::hb23d80071754d3d6
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/rt.rs:65:5
  27:     0x7f663b81860a - main
  28:     0x7f663a421b97 - __libc_start_main
  29:     0x7f663b80d77a - _start
  30:                0x0 - <unknown>

I barely have Rust knowledge (I started the book, got distracted, and plan to revisit it soon!) so I'm sorry if it's a simple mistake on my end. I just wanted to test this out.

@lf94
Copy link
Owner

lf94 commented Feb 23, 2021

Taking a guess it's talking about PNG signature. Maybe try one of the samples in the repo?

@sijinglim
Copy link
Author

🤦‍♂️ Should have tried that first to make sure things are working as expected. And it does, the inputs folder has working image inputs.

Still, I'd like to try out my input image to check the result. I'm not too familiar with PNGs either so what are your suggestions on getting that working?

@sijinglim
Copy link
Author

I just opened my input image in paint and saved it as test2.png and now it works. The source of the original image was through Windows 10's new snipping tool, might be good to keep note of.

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

2 participants