rbpf icon indicating copy to clipboard operation
rbpf copied to clipboard

panicked at 'attempt to divide by zero'

Open charlesxsh opened this issue 3 years ago • 0 comments

Input in.zip

Code

fn main() {
    // let filepath = input file in the zip
    let data = std::fs::read(filepath).unwrap();
    if let Ok(vm) = rbpf::EbpfVmNoData::new(Some(&data)) {
        vm.execute_program();

    }

    
}

Output

thread 'main' panicked at 'attempt to divide by zero', /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:461:33
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: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic
   9: rbpf::EbpfVmMbuff::execute_program
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:461
  10: rbpf::EbpfVmRaw::execute_program
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:1257
  11: rbpf::EbpfVmNoData::execute_program
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:1540

Expect properly return error instead of panic

charlesxsh avatar Jul 16 '21 04:07 charlesxsh