Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Allowing -m none option for afl-cmin and afl-tmin #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions afl_utils/afl_minimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,23 @@ def show_info():
print("Corpus minimization utility for afl-fuzz corpora.")
print("")

def convert_mem_limit(mem_limit):
if mem_limit is not None:
if mem_limit=="none":
return "none"
else:
try:
return int(mem_limit)
except ValueError as verr:
print_err("Converting --cmin-mem-limit to int failed. Please use either \"none\" or a valid integer")
raise verr

def invoke_cmin(input_dir, output_dir, target_cmd, mem_limit=None, timeout=None, qemu=False):
success = True
cmin_cmd = "afl-cmin "

if mem_limit is not None:
cmin_cmd += "-m %d " % int(mem_limit)
cmin_cmd += "-m %s " % convert_mem_limit(mem_limit)

if timeout is not None:
cmin_cmd += "-t %d " % int(timeout)
Expand Down Expand Up @@ -78,7 +88,7 @@ def invoke_tmin(input_files, output_dir, target_cmd, num_threads=1, mem_limit=No
tmin_cmd = "afl-tmin "

if mem_limit is not None:
tmin_cmd += "-m %d " % int(mem_limit)
tmin_cmd += "-m %s " % convert_mem_limit(mem_limit)

if timeout is not None:
tmin_cmd += "-t %d " % int(timeout)
Expand Down