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

panicked at 'attempt to add with overflow' #51

Closed
charlesxsh opened this issue Jul 16, 2021 · 3 comments · Fixed by #98
Closed

panicked at 'attempt to add with overflow' #51

charlesxsh opened this issue Jul 16, 2021 · 3 comments · Fixed by #98

Comments

@charlesxsh
Copy link

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 add with overflow', /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:583:45
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::check_mem
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:583
  10: rbpf::EbpfVmMbuff::execute_program::{{closure}}
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:301
  11: rbpf::EbpfVmMbuff::execute_program
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:372
  12: rbpf::EbpfVmRaw::execute_program
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/rbpf-0.1.0/src/lib.rs:1257
  13: 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

@Gkozd
Copy link

Gkozd commented Jul 21, 2021

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)) {
    
            Ok(vm) => data,
            Err(err) => {
                println!("{}", err);

                break;
                    }
            vm.execute_program();
   } 
}

//?

@charlesxsh
Copy link
Author

Sorry I don't get it? @Gkozd

@qmonnet
Copy link
Owner

qmonnet commented Jan 5, 2024

Looks the same as #94, which should hopefully be addressed in #98.

@qmonnet qmonnet linked a pull request Jan 5, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants