8051Enthusiast / delsum

A reverse engineer's checksum toolbox
MIT License
138 stars 6 forks source link

Crashing on `delsum reverse` #2

Closed FFY00 closed 3 years ago

FFY00 commented 3 years ago
$ RUST_BACKTRACE=full delsum reverse -m 'crc width=32 poly=0x4c11db7 init=0xffffffff xorout=0xffffffff' -c 5D58A73F,C4B48B8E,F4EFC517,AEFADCE9 *.bin
stack backtrace:
   0:     0x55663918a410 - std::backtrace_rs::backtrace::libunwind::trace::h3244117ea50123fe
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x55663918a410 - std::backtrace_rs::backtrace::trace_unsynchronized::h68c610493487144f
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x55663918a410 - std::sys_common::backtrace::_print_fmt::h98a015f47bac7d62
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:79
   3:     0x55663918a410 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc852ad3e88e43049
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:58
   4:     0x5566391a5edc - core::fmt::write::h5437b03347b2ec7a
                               at /build/rust/src/rustc-1.48.0-src/library/core/src/fmt/mod.rs:1080
   5:     0x556639187145 - std::io::Write::write_fmt::h1c132b3b8a60ce2f
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/io/mod.rs:1516
   6:     0x55663918c7fd - std::sys_common::backtrace::_print::hdfae0c73b5d1550a
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:61
   7:     0x55663918c7fd - std::sys_common::backtrace::print::h846d8b35d353226f
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:48
   8:     0x55663918c7fd - std::panicking::default_hook::{{closure}}::h611a677a9567debb
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:208
   9:     0x55663918c4a8 - std::panicking::default_hook::hfc5e7967f3ac8efb
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:227
  10:     0x55663918cee1 - std::panicking::rust_panic_with_hook::h86da1db1d0779194
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:577
  11:     0x5566390c70fc - std::panicking::begin_panic::{{closure}}::h9f714e109b8ee093
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:506
  12:     0x5566390c62c9 - std::sys_common::backtrace::__rust_end_short_backtrace::h9d872424d8ca7f6a
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:153
  13:     0x5566390c7027 - std::panicking::begin_panic::ha839368c295f54c4
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:505
  14:     0x556638fa3a0a - delsum_lib::find_algorithm::h10900193752313ea
                               at /home/anubis/git/delsum/delsum-lib/src/lib.rs:267
  15:     0x556638be77c7 - delsum::reverse::{{closure}}::h63c2e7b2193d5332
                               at /home/anubis/git/delsum/src/bin.rs:25
  16:     0x556638be7e53 - delsum::reverse::{{closure}}::h43a7680c177ca232
                               at /home/anubis/git/delsum/src/bin.rs:47
  17:     0x556638bb0157 - <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::for_each::h5387447c4f01e632
                               at /build/rust/src/rustc-1.48.0-src/library/core/src/slice/iter/macros.rs:203
  18:     0x556638b91b26 - delsum::reverse::h6c213b38fb9cf4db
                               at /home/anubis/git/delsum/src/bin.rs:46
  19:     0x556638b91883 - delsum::main::hb3e02f305410719c
                               at /home/anubis/git/delsum/src/bin.rs:15
  20:     0x556638bfa5bb - core::ops::function::FnOnce::call_once::h6f5d4ec0750029df
                               at /build/rust/src/rustc-1.48.0-src/library/core/src/ops/function.rs:227
  21:     0x556638b9b1ee - std::sys_common::backtrace::__rust_begin_short_backtrace::h13fb86221e94b6af
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:137
  22:     0x556638b9a601 - std::rt::lang_start::{{closure}}::hd6aa401195fe1aa2
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/rt.rs:66
  23:     0x55663918d3f7 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hba2eeded6e43561f
                               at /build/rust/src/rustc-1.48.0-src/library/core/src/ops/function.rs:259
  24:     0x55663918d3f7 - std::panicking::try::do_call::h2d2f9a7ece5d85e2
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:381
  25:     0x55663918d3f7 - std::panicking::try::he67fa7d0004e7010
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panicking.rs:345
  26:     0x55663918d3f7 - std::panic::catch_unwind::h61fcdf94f063131b
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/panic.rs:382
  27:     0x55663918d3f7 - std::rt::lang_start_internal::h0c3b9dc1678c8c77
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/rt.rs:51
  28:     0x556638b9a5d7 - std::rt::lang_start::h5bbfd59f1a9e08a2
                               at /build/rust/src/rustc-1.48.0-src/library/std/src/rt.rs:65
  29:     0x556638b953da - main
  30:     0x7fd73085d152 - __libc_start_main
  31:     0x556638b8c2ee - _start
  32:                0x0 - <unknown>

firmware-steelseries-rival-310.zip

8051Enthusiast commented 3 years ago
    if sums.len() != bytes.len() {
        panic!("Help how do I error handle this?")
    }

Looks like I forgot to implement proper error handling in this location, sorry. I'll have to fix this when I have time.

Anyway, this should pop up if the number of checksums provided doesn't match the number of files provided. Were there maybe other *.bin files in the same folder?

FFY00 commented 3 years ago

Oh, right. I had copied one of the files to try something.