Commit abe77c57 authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

Turn DCHECKs in FindSharedFunctionInfo into CHECKs

When we try to get a function literal with an ID beyond the
last known ID we easily create out-of-bound read bugs. It's preferable
to crash in this situation.

BUG=chromium:789764
R=marja@chromium.org

Change-Id: I4f35e9231ef6af18204bbac96df3652c3d30c29f
Reviewed-on: https://chromium-review.googlesource.com/798411Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49738}
parent f34c58a0
......@@ -13417,8 +13417,8 @@ Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo(
Isolate* isolate, const FunctionLiteral* fun) {
DCHECK_NE(fun->function_literal_id(), FunctionLiteral::kIdTypeInvalid);
DCHECK_LT(fun->function_literal_id(), shared_function_infos()->length());
CHECK_NE(fun->function_literal_id(), FunctionLiteral::kIdTypeInvalid);
CHECK_LT(fun->function_literal_id(), shared_function_infos()->length());
Object* shared = shared_function_infos()->get(fun->function_literal_id());
if (shared->IsUndefined(isolate) || WeakCell::cast(shared)->cleared()) {
return MaybeHandle<SharedFunctionInfo>();
......
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