keystone-engine/keystone

Infinite loop on AsmParser::Run using .string, etc. directive

tin-z opened this issue · 0 comments

tin-z commented

If the .string directive argument is enclosed using ' char, then an infinite loop happens on AsmParser::Run.

  • PoC:
from keystone import *
ks = Ks(KS_ARCH_X86, KS_MODE_32)

# good case
CODE = ".string \"test\"; nop;"
encoding, count = ks.asm(CODE)

# bad case
CODE = ".string 'test'; nop;"
encoding, count = ks.asm(CODE)