[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:
Leszek Swirski 2019-04-02 11:23:28 +02:00 committed by Commit Bot
parent 9ac3ec565d
commit 837e8f5e1a
2 changed files with 14 additions and 1 deletions

View File

@ -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());

View 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);