Skip to content

Various errors in operation.Operand #33

Description

@845977

Error 1: Memory operand type destroyed by set_dst / set_src

_parse_type correctly sets self.type = op_mem for [dst] and [src] placeholders, but both set_dst and set_src unconditionally overwrite self.type to op_reg (or op_imm) when a concrete value is provided, discarding the memory type entirely.

Error 2: set_dst rejects immediate values

rop3/rop3/operation.py

Lines 250 to 254 in 95f6cb9

def set_dst(self, dst):
if self.is_dst():
self.reg = dst
self.generic = False
self.type = arch_singleton.arch.op_reg

set_src tries _parse_imm before falling back to a register name, so --src 4 or --src 0x10 correctly produces an op_imm operand. set_dst had no equivalent and should do the same.

Error 3: Generic mem addresses can be resolved into immediates

rop3/rop3/operation.py

Lines 274 to 275 in 95f6cb9

if self.generic and self.is_src() and operand.type == arch_singleton.arch.op_imm:
return (True, operand.value.imm)

This is not desired behaviour, mov rax, 0xCAFE is not a ROPLang load.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions