Ejemplo n.º 1
0
def _get_runner():
  """Get the honggfuzz runner."""
  honggfuzz_path = os.path.join(environment.get_value('BUILD_DIR'), 'honggfuzz')
  if not os.path.exists(honggfuzz_path):
    raise HonggfuzzError('honggfuzz not found in build')

  os.chmod(honggfuzz_path, 0o755)
  return new_process.UnicodeProcessRunner(honggfuzz_path)
Ejemplo n.º 2
0
def _run_with_interpreter_if_needed(fuzzer_path, args, max_time):
  """Execute the fuzzer script with an interpreter, or invoke it directly."""
  interpreter = shell.get_interpreter(fuzzer_path)
  if interpreter:
    executable = interpreter
    args.insert(0, fuzzer_path)
  else:
    executable = fuzzer_path

  runner = new_process.UnicodeProcessRunner(executable)
  return runner.run_and_wait(timeout=max_time, additional_args=args)
Ejemplo n.º 3
0
    def reproduce(self, target_path, input_path, arguments, max_time):  # pylint: disable=unused-argument
        """Reproduce a crash given an input.

    Args:
      target_path: Path to the target.
      input_path: Path to the reproducer input.
      arguments: Additional arguments needed for reproduction.
      max_time: Maximum allowed time for the reproduction.

    Returns:
      A ReproduceResult.
    """
        os.chmod(target_path, 0o775)
        runner = new_process.UnicodeProcessRunner(target_path)
        with open(input_path) as f:
            result = runner.run_and_wait(timeout=max_time, stdin=f)

        return engine.ReproduceResult(result.command, result.return_code,
                                      result.time_executed, result.output)