def engine_fuzz(request, _): """Run engine fuzzer.""" engine_impl = engine.get(request.engine) result, fuzzer_metadata, strategies = fuzz_task.run_engine_fuzzer( engine_impl, request.target_name, request.sync_corpus_directory, request.testcase_directory) crashes = [ untrusted_runner_pb2.EngineCrash(input_path=crash.input_path, stacktrace=crash.stacktrace, reproduce_args=crash.reproduce_args, crash_time=crash.crash_time) for crash in result.crashes ] packed_stats = _pack_values(result.stats) packed_strategies = _pack_values(strategies) return untrusted_runner_pb2.EngineFuzzResponse( logs=result.logs, command=result.command, crashes=crashes, stats=packed_stats, time_executed=result.time_executed, fuzzer_metadata=fuzzer_metadata, strategies=packed_strategies)
def engine_fuzz(request, _): """Run engine fuzzer.""" engine_impl = engine.get(request.engine) result, fuzzer_metadata = fuzz_task.run_engine_fuzzer( engine_impl, request.target_name, request.sync_corpus_directory, request.testcase_directory, ) crashes = [ untrusted_runner_pb2.EngineCrash( input_path=crash.input_path, stacktrace=protobuf_utils.encode_utf8_if_unicode(crash.stacktrace), reproduce_args=crash.reproduce_args, crash_time=crash.crash_time, ) for crash in result.crashes ] packed_stats = {} for key, value in six.iteritems(result.stats): packed_value = Any() if isinstance(value, float): packed_value.Pack(wrappers_pb2.DoubleValue(value=value)) elif isinstance(value, int): packed_value.Pack(wrappers_pb2.Int32Value(value=value)) elif isinstance(value, six.string_types): packed_value.Pack(wrappers_pb2.StringValue(value=value)) else: raise ValueError("Unknown stat type for " + key) packed_stats[key] = packed_value return untrusted_runner_pb2.EngineFuzzResponse( logs=protobuf_utils.encode_utf8_if_unicode(result.logs), command=result.command, crashes=crashes, stats=packed_stats, time_executed=result.time_executed, fuzzer_metadata=fuzzer_metadata, )