iximeow / yaxpeax-x86

x86 decoders for the yaxpeax project
BSD Zero Clause License
129 stars 23 forks source link

DisplayStyle::C can't print "jmp rax" #18

Closed mstange closed 2 years ago

mstange commented 2 years ago
fn main() {
    use yaxpeax_arch::Decoder;
    let decoder = yaxpeax_x86::amd64::InstDecoder::default();
    let inst = decoder.decode_slice(&[0xFF, 0xE0]).unwrap();
    println!("{}", inst.display_with(yaxpeax_x86::amd64::DisplayStyle::C));
}

hits the unreachable! in write_jmp_operand:

https://github.com/iximeow/yaxpeax-x86/blob/1dc77c26e1de52f43b0841f60c42f9581ac31f77/src/long_mode/display.rs#L3519-L3537

iximeow commented 2 years ago

thank you for the report! DisplayStyle::C slipped by with the fuzzing that landed recently and, lo, it had a bug.

i've fixed this reachable unreachable and added the same "display must not panic" fuzzing for DisplayStyle::C as we have for DisplayStyle::Intel, in e80b562. with that patch, fuzzing seems to have no further issues, and i've published a yaxpeax-x86 1.1.4 that includes the fix.

mstange commented 2 years ago

Thanks!

mstange commented 2 years ago

It appears that 1.1.4 hasn't been published yet.

iximeow commented 2 years ago

agh, i tagged the commit but must have forgot to cargo publish. actually published now.

mstange commented 2 years ago

Thank you!