Commit c63f1051 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[fuzzer] Make parser fuzzer handle pending exceptions.

This ensures exceptions thrown during parsing are properly propagated
into the surrounding {v8::TryCatch} block. Otherwise running more than
one test input in the same Isolate can fail due to pending exceptions. 

R=jochen@chromium.org
BUG=chromium:715037

Change-Id: Iaa5735515dc097d8cb12dcf8672451f3c9503440
Reviewed-on: https://chromium-review.googlesource.com/490047
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45019}
parent f5fad6d9
......@@ -672,7 +672,7 @@ class Isolate {
// exceptions. If an exception was thrown and not handled by an external
// handler the exception is scheduled to be rethrown when we return to running
// JavaScript code. If an exception is scheduled true is returned.
bool OptionalRescheduleException(bool is_bottom_call);
V8_EXPORT_PRIVATE bool OptionalRescheduleException(bool is_bottom_call);
// Push and pop a promise and the current try-catch handler.
void PushPromise(Handle<JSObject> promise);
......
......@@ -36,7 +36,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
v8::internal::Handle<v8::internal::Script> script =
factory->NewScript(source.ToHandleChecked());
v8::internal::ParseInfo info(script);
v8::internal::parsing::ParseProgram(&info, i_isolate);
if (!v8::internal::parsing::ParseProgram(&info, i_isolate)) {
i_isolate->OptionalRescheduleException(true);
}
isolate->RequestGarbageCollectionForTesting(
v8::Isolate::kFullGarbageCollection);
return 0;
......
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