suite: more throughout fuzzing

This commit is contained in:
Nguyen Anh Quynh 2014-03-04 15:32:28 +08:00
parent ce2ad202d2
commit d9ee9b114f
1 changed files with 22 additions and 18 deletions

View File

@ -23,6 +23,7 @@ import sys
FILE = '/usr/bin/python' FILE = '/usr/bin/python'
TIMES = 64 TIMES = 64
INTERVALS = (4, 5, 7, 9, 11, 13)
all_tests = ( all_tests = (
(CS_ARCH_X86, CS_MODE_16, "X86-16bit (Intel syntax)", 0), (CS_ARCH_X86, CS_MODE_16, "X86-16bit (Intel syntax)", 0),
@ -90,27 +91,30 @@ for (arch, mode, comment, syntax) in all_tests:
md.syntax = syntax md.syntax = syntax
# test disasm() # test disasm()
print("Fuzzing disasm() @platform: %s" %comment) print("\nFuzzing disasm() @platform: %s" %comment)
for i in xrange(1, TIMES): for ii in INTERVALS:
while (True): print("Interval: %u" %ii)
code = get_code(cfile, i * 4) for j in xrange(1, TIMES):
if code is None: while (True):
# EOF? break code = get_code(cfile, j * ii)
break if code is None:
#print to_hex(code) # EOF? break
cs(md, code) break
#print to_hex(code)
cs(md, code)
# test disasm_lite() # test disasm_lite()
print("Fuzzing disasm_lite() @platform: %s" %comment) print("Fuzzing disasm_lite() @platform: %s" %comment)
cfile.seek(0) for ii in INTERVALS:
for i in xrange(1, TIMES): print("Interval: %u" %ii)
while (True): for j in xrange(1, TIMES):
code = get_code(cfile, i * 4) while (True):
if code is None: code = get_code(cfile, j * ii)
# EOF? break if code is None:
break # EOF? break
#print to_hex(code) break
cs_lite(md, code) #print to_hex(code)
cs_lite(md, code)
except CsError as e: except CsError as e:
print("ERROR: %s" %e) print("ERROR: %s" %e)