Skip to content
Snippets Groups Projects
Commit 07123318 authored by Nguyen Anh Quynh's avatar Nguyen Anh Quynh
Browse files

regress: add testcase for #68

parent 1bf32895
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# Handle modulo 0 or div 0 issue
# Github issue: #68
# Author: Nguyen Anh Quynh
from keystone import *
import regress
CODE1 = b"jne 4014%0"
CODE2 = b"jne 4014/0"
class TestX86(regress.RegressTest):
def runTest(self):
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, KS_MODE_32)
try:
encoding, count = ks.asm(CODE1)
except KsError as e:
if e.errno == KS_ERR_ASM_INVALIDOPERAND:
print("Got error KS_ERR_ASM_INVALIDOPERAND as expected")
else:
self.assertFalse(1, "ERROR: %s" % e)
try:
encoding, count = ks.asm(CODE2)
except KsError as e:
if e.errno == KS_ERR_ASM_INVALIDOPERAND:
print("Got error KS_ERR_ASM_INVALIDOPERAND as expected")
else:
self.assertFalse(1, "ERROR: %s" % e)
if __name__ == '__main__':
regress.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment