From 3f7ead2039510723c58a7b27421fa8d29dbf3fb9 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Wed, 2 Nov 2016 15:11:02 -0700 Subject: [PATCH] do not use python, use bash --- infra/base-images/base-libfuzzer/Dockerfile | 2 +- infra/base-images/base-libfuzzer/just_run | 31 ++++++++------------- targets/expat/parse_fuzzer.options | 1 + 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/infra/base-images/base-libfuzzer/Dockerfile b/infra/base-images/base-libfuzzer/Dockerfile index fd405f63532f..b2ecb5be98a8 100644 --- a/infra/base-images/base-libfuzzer/Dockerfile +++ b/infra/base-images/base-libfuzzer/Dockerfile @@ -16,7 +16,7 @@ FROM ossfuzz/base-clang MAINTAINER mike.aizatsky@gmail.com -RUN apt-get install -y libc6-dev libtool git subversion jq zip python3 +RUN apt-get install -y libc6-dev libtool git subversion jq zip ENV SANITIZER_FLAGS="-fsanitize=address" ENV COV_FLAGS="-fsanitize-coverage=edge,indirect-calls,8bit-counters" diff --git a/infra/base-images/base-libfuzzer/just_run b/infra/base-images/base-libfuzzer/just_run index 8e834591ab42..ededbee483ab 100755 --- a/infra/base-images/base-libfuzzer/just_run +++ b/infra/base-images/base-libfuzzer/just_run @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/bin/bash -eu # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,24 +17,15 @@ # Fuzzer runner. -import configparser -import os -import subprocess -import sys +FUZZER=$1 +shift +CMD_LINE="$FUZZER $@" -run_args = sys.argv[1:] +OPTIONS_FILE="${FUZZER}.options" +if [ -f $OPTIONS_FILE ]; then + OPTIONS_ARGS=$(grep "=" $OPTIONS_FILE | sed 's/\(\w*\)\W*=\W*\(.*\)/-\1=\2 /g' | tr '\n' ' ') + CMD_LINE="$CMD_LINE $OPTIONS_ARGS" +fi -# Use .options file if any. -fuzzer_name = run_args[0] -options_file = fuzzer_name + ".options" -if os.path.isfile(options_file): - config = configparser.ConfigParser() - config.read(options_file) - for (key, value) in config["libfuzzer"].items(): - run_args.append("-{0}={1}".format(key, value)) - -# Run -print("$", " ".join(run_args)) -run_process = subprocess.Popen(run_args) -run_process.wait() -assert run_process.returncode == 0 +echo $CMD_LINE +bash -c "$CMD_LINE" diff --git a/targets/expat/parse_fuzzer.options b/targets/expat/parse_fuzzer.options index 6335e163b279..46f3f567c31b 100644 --- a/targets/expat/parse_fuzzer.options +++ b/targets/expat/parse_fuzzer.options @@ -1,2 +1,3 @@ [libfuzzer] dict = xml.dict +max_len = 1024