-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I fully recognize I could be doing something wrong so I welcome any pointers...
With this plugin, if you grab some mips32 assembly (you can use some shell code from msf for example):
li $t7, -6
nor $t7, $t7, $zero
addi $a0, $t7, -3
addi $a1, $t7, -3
slti $a2, $zero, -1
li $v0, 4183
syscall 0x40404
slt $s0, $zero, $a3
bne $s0, $zero, failed
sw $v0, -4($sp) Go ahead and assemble it with hex output via the plugin:
Now take that output and push it back through as input and disassemble it into mips mnemonics
It looks like this happens because mips32 (per the docs) has the max_instr_length property set to 8.
the value for mips32 is currently 8 because multiple instructions are decoded looking for delay slots so they can be reordered.
Which the plugin, seemingly correctly, utilizes here:
Line 81 in cf7045e
| instruction_length = len(bv.read(offset, self.arch.max_instr_length)) |
My workaround has been setting that property to 4 for the sake of outputting mnemonics I'm expecting...
I don't have any great solutions (other API magic in binja to be called?) but wanted to report the issue as you'll probably have a better idea on how best to work around this sanely.
Thanks!