Closed lenawanel closed 1 year ago
Thanks for the bug report!
Since there's no ND_SIZE_*
macro for 0 it was completely ignored. There's an argument to be made here against unwrap
ing in functions such as operands
and instead let the errors bubble up to the callers.
A fix is available in 0.3
. Note that I did not check other parts of the code for similar errors yet.
executing the following code panics with
'called `Result::unwrap()` on an `Err` value: InternalError(0)', /home/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bddisasm-0.2.1/src/decoded_instruction.rs:484:84
Backtrace
``` thread 'tests::bddisam_test' panicked at 'called `Result::unwrap()` on an `Err` value: InternalError(0)', /home//.cargo/registry/src/index.crates.io-6f17d22bba15001f/bddisasm-0.2.1/src/decoded_instruction.rs:484:84
stack backtrace:
0: rust_begin_unwind
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/std/src/panicking.rs:593:5
1: core::panicking::panic_fmt
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/core/src/panicking.rs:67:14
2: core::result::unwrap_failed
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/core/src/result.rs:1651:5
3: core::result::Result::unwrap
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/core/src/result.rs:1076:23
4: bddisasm::decoded_instruction::DecodedInstruction::operands
at /home//.cargo/registry/src/index.crates.io-6f17d22bba15001f/bddisasm-0.2.1/src/decoded_instruction.rs:484:17
5: ::tests::bddisam_test
at ./src/lib.rs:15:17
6: ::tests::bddisam_test::{{closure}}
at ./src/lib.rs:9:23
7: core::ops::function::FnOnce::call_once
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /rustc/dd5d7c729d4e8a59708df64002e09dbcbc4005ba/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
this was encountered while trying to disassemble
__libc_start_main
from a compiled C binary. bddisasm crate version: "0.2.1".