qmonnet / rbpf

Rust virtual machine and JIT compiler for eBPF programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panicked at 'attempt to calculate the remainder with a divisor of zero'

charlesxsh opened this issue · 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 calculate the remainder with a divisor of zero', /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:477: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:477
  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
  12: rbpffuzzvrf::main

Expect
properly return error instead of panic