keystone icon indicating copy to clipboard operation
keystone copied to clipboard

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

Open tin-z opened this issue 2 years ago • 0 comments

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)

tin-z avatar Aug 12 '22 14:08 tin-z