IDA "Invalid Operand" error when patching
Asked Answered
T

2

6

I am attempting to patch a binary in IDA using the "Assemble" option, and every time I enter an instruction with some arithmetic to calculate the offset, I receive an Invalid Operand error. For example:

mov [bp-4], bx       

returns Invalid Operand, while

mov ax, bx

works.

I've attempted playing around with the format of the instruction (eg include word ptr, use 4h, etc) but nothing seems to work. Is there any way about this error, or is entering byte code for patching the only option?

Thremmatology answered 18/6, 2014 at 20:2 Comment(2)
Try ebp there, a pointer must be 32-bit one if you are in 32-bit mode and 64-bit value (rbp) if it's long mode.Tripletail
I am working in 16-bit modeThremmatology
C
7

according to Hex Rays:

The assembler command is supported for only a few processors, only a few instructions. We do not plan to extend this feature, sorry

Lame, I know.

Commutable answered 22/7, 2016 at 14:44 Comment(0)
F
2

A bit late, but although the Assemble dialog says "Invalid operand" if you know the bytecode you can use the Change byte... menu option instead. You could use OllyDbg to assemble to bytecode (select anywhere and hit space), then copy that into IDA's Change byte dialog as a workaround.

Fraternity answered 18/9, 2016 at 7:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.