Commit 95c5c76f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] [fuzzer] Bound the number of steps to execute

To avoid running infinitely or hitting the stack size limit, bound the
number of steps to execute in the interpreter to 16k.

R=ahaas@chromium.org
BUG=chromium:708457

Change-Id: Ib101bbbc06627641dae2fd1cd1a8d950aa504eaf
Reviewed-on: https://chromium-review.googlesource.com/469609
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44446}
parent 9461fe24
......@@ -115,6 +115,9 @@ int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
const ModuleWireBytes& wire_bytes,
int function_index, WasmVal* args,
bool* possible_nondeterminism) {
// Don't execute more than 16k steps.
constexpr int kMaxNumSteps = 16 * 1024;
DCHECK_NOT_NULL(module);
Zone zone(isolate->allocator(), ZONE_NAME);
v8::internal::HandleScope scope(isolate);
......@@ -144,7 +147,7 @@ int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
WasmInterpreter::Thread* thread = interpreter.GetThread(0);
thread->Reset();
thread->InitFrame(&(module->functions[function_index]), args);
WasmInterpreter::State interpreter_result = thread->Run();
WasmInterpreter::State interpreter_result = thread->Run(kMaxNumSteps);
if (instance.mem_start) {
free(instance.mem_start);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment