Skip to content

pyvex fails to decode some Mov instructions with 66 prefix #536

Description

@tedanvosin

Description

pyvex sets jumpkind to 'Ijk_NoDecode' for some MOVSX/MOVZX instructions with '66' prefix.

Steps to reproduce the bug

Run the following test:

import unittest

import pyvex

class Tests(unittest.TestCase):

    def test_amd64_movzx_66_prefix(self):
        inst_bytes = b"\x66\x0f\xb7\xc0" # movzx ax, ax

        irsb = pyvex.IRSB(inst_bytes, 0, pyvex.ARCH_AMD64)
        assert irsb.jumpkind == "Ijk_Boring"
        assert irsb.size == 4

    def test_amd64_movsx_66_prefix(self):
        inst_bytes = b"\x66\x0f\xbf\xc0" # movsx ax, ax
        
        irsb = pyvex.IRSB(inst_bytes, 0, pyvex.ARCH_AMD64)
        assert irsb.jumpkind == "Ijk_Boring"
        assert irsb.size == 4

    def test_amd64_movzx_66_prefix_memory(self):
        inst_bytes = b"\x66\x45\x0f\xb7\x5c\x27\x6a" # movzx r11w, word ptr [r15 + riz + 0x6a]

        irsb = pyvex.IRSB(inst_bytes, 0, pyvex.ARCH_AMD64)
        assert irsb.jumpkind == "Ijk_Boring"
        assert irsb.size == 7


if __name__ == "__main__":
    unittest.main()

Environment

pyvex version 9.2.213.dev0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    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