[parser] Fail early for two-byte intrinsic calls
Don't just DCHECK that intrinsic calls are one-byte, but explicitly check and return (a failure) when they are not. Bug: chromium:948248 Change-Id: If2c16f337e9c97e5a585d21a51a985f4abbe1c29 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1547857 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#60565}
This commit is contained in:
parent
9ac3ec565d
commit
837e8f5e1a
@ -347,7 +347,12 @@ Expression* Parser::NewV8Intrinsic(const AstRawString* name,
|
||||
GetClosureScope()->ForceEagerCompilation();
|
||||
}
|
||||
|
||||
DCHECK(name->is_one_byte());
|
||||
if (!name->is_one_byte()) {
|
||||
// There are no two-byte named intrinsics.
|
||||
ReportMessage(MessageTemplate::kNotDefined, name);
|
||||
return FailureExpression();
|
||||
}
|
||||
|
||||
const Runtime::Function* function =
|
||||
Runtime::FunctionForName(name->raw_data(), name->length());
|
||||
|
||||
|
8
test/mjsunit/regress/regress-948248.js
Normal file
8
test/mjsunit/regress/regress-948248.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
// Non-ascii intrinsic calls shouldn't crash V8.
|
||||
assertThrows("%ಠ_ಠ()", SyntaxError);
|
Loading…
Reference in New Issue
Block a user