airbus-seclab / bincat

Binary code static analyser, with IDA integration. Performs value and taint analysis, type reconstruction, use-after-free and double-free detection
1.67k stars 161 forks source link

Missing semantic for bswap #114

Closed DarkaMaul closed 4 years ago

DarkaMaul commented 4 years ago

Hello,

The semantic for bswap (opcode OxC8) mnemonic (x86, x64) is missing from the disassembler.

Here is a snippet of a problematic code:

int main(int argc, char** argv) {
    int swap;
    asm volatile(
        "sub $0x1000,%%rsp;"
        "mov $0xabcd,%%ebx;"
        "bswap %%ebx;"
        : "=a" (swap)
        :
    );
    return 0;
}

If needed, the error log:

INFO:bincat.plugin:[EXCEPTION] main: Exception caught in main loop
INFO:bincat.plugin:Exceptions.Error("at 0x1150: unknown second opcode 0xcb\n")
INFO:bincat.plugin:Raised at file "fixpoint/interpreter.ml", line 777, characters 82-89
INFO:bincat.plugin:Called from file "main.ml", line 153, characters 25-60
phil777 commented 4 years ago

Added here: 44004b247ecffb4dce6b11d26ad51af26ff81b9c

Please test and reopen if it does not work.

DarkaMaul commented 4 years ago

Works well, thanks!