Vector35 / Vector35/binaryninja-api
rep movsd instruction does not round-trip in disassembler/assembler
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
x86 assembler does not seem to be working for 'rep mov' instructions...code below demonstrates the issue
from binaryninja import Architecture
arch = Architecture['x86']
instr_bytes = b'\xf3\xa5' # rep movsd dword [edi], [esi]
txt, size = arch.get_instruction_text(instr_bytes, 0)
instr = ''.join(str(a) for a in txt).strip()
# now 'instr' holds: "rep movsd dword [edi], [esi]"
assem = arch.assemble(instr)
arch.assemble fails with: ValueError: Could not assemble: b': error: warnings being treated as errors\ninput:1: error: invalid combination of opcode and operands'
Note: it also fails if I do:
disassem = bv.get_disassembly_at(addr)
bv.arch.assemble(disassem)
It also seems to fail on movsb byte [edi], [esi] type instructions.
Thanks for checking this out...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python reproducer using Architecture['x86'], get_instruction_text, and arch.assemble for the rep movsd and movsb examples. Trace why the disassembled operand form is rejected, then verify that the shown instructions round-trip through disassembly and assembly without the invalid-operand error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100