[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: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#44446}
This commit is contained in:
parent
9461fe249e
commit
95c5c76fe3
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user