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

Panic on overflow in subtraction #1

neosilky opened this issue May 23, 2017 · 1 comment


None yet
2 participants
Copy link

commented May 23, 2017

Found using cargo-fuzz.

extern crate ssh_parser;

fn main() {
    let data = b"\x00\x00\x00\x00\x00\x00\x00\x00";
    let _ = ssh_parser::parse_ssh_packet(data);
thread '<unnamed>' panicked at 'attempt to subtract with overflow', src/
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/
             at /checkout/src/libstd/
   3: std::panicking::default_hook
             at /checkout/src/libstd/
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/
   5: std::panicking::begin_panic
             at /checkout/src/libstd/
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/
   7: rust_begin_unwind
             at /checkout/src/libstd/
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/
   9: core::panicking::panic
             at /checkout/src/libcore/
  10: ssh_parser::ssh::parse_ssh_packet
             at src/
  11: rust_fuzzer_test_input
             at fuzz/fuzzers/
  12: libfuzzer_sys::test_input_wrap::{{closure}}
             at /home/neo/.cargo/git/checkouts/libfuzzer-sys-e07fde05820d7bc6/bcaa8e1/src/
  13: std::panicking::try::do_call
             at /checkout/src/libstd/
  14: <unknown>
             at /checkout/src/libpanic_abort/
==2713== ERROR: libFuzzer: deadly signal
    #0 0x5556b31e6aa3 in __sanitizer_print_stack_trace /checkout/src/compiler-rt/lib/asan/
    #1 0x5556b3092bb1 in fuzzer::Fuzzer::CrashCallback() /home/neo/.cargo/git/checkouts/libfuzzer-sys-e07fde05820d7bc6/bcaa8e1/llvm/lib/Fuzzer/FuzzerLoop.cpp:280
    #2 0x5556b3092afb in fuzzer::Fuzzer::StaticCrashSignalCallback() /home/neo/.cargo/git/checkouts/libfuzzer-sys-e07fde05820d7bc6/bcaa8e1/llvm/lib/Fuzzer/FuzzerLoop.cpp:264
    #3 0x5556b30b02ed in fuzzer::CrashHandler(int, siginfo_t*, void*) /home/neo/.cargo/git/checkouts/libfuzzer-sys-e07fde05820d7bc6/bcaa8e1/llvm/lib/Fuzzer/FuzzerUtilPosix.cpp:37
    #4 0x7f0326ed4fdf  (/usr/lib/
    #5 0x7f0326936a0f in __GI_raise (/usr/lib/
    #6 0x7f0326938139 in __GI_abort (/usr/lib/
    #7 0x5556b3117278 in panic_abort::__rust_start_panic::abort /checkout/src/libpanic_abort/
    #8 0x5556b3117278 in __rust_start_panic /checkout/src/libpanic_abort/

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
MS: 3 ChangeBinInt-EraseBytes-CMP- DE: "\x00\x00\x00\x00\x00\x00\x00\x00"-; base unit: f962cb5827b3fc32cfe0eeb4b3034c067e34138e

Down to the following line:

@nizox nizox closed this in 7649370 May 23, 2017


This comment has been minimized.

Copy link

commented May 23, 2017


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.