[string] Fix error message in String.prototype.repeat.
R=yangguo@chromium.org TEST=message/regress/regress-crbug-691194 BUG=chromium:691194 Change-Id: I72198e087f88abf89cdd38b99c19e10cbebda08d Reviewed-on: https://chromium-review.googlesource.com/445942 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#43480}
This commit is contained in:
parent
09a07038f2
commit
08d84f6d23
@ -220,7 +220,7 @@ function StringRepeat(count) {
|
||||
|
||||
// The maximum string length is stored in a smi, so a longer repeat
|
||||
// must result in a range error.
|
||||
if (n > %_MaxSmi()) throw %make_range_error(kInvalidCountValue);
|
||||
if (n > %_MaxSmi()) throw %make_range_error(kInvalidStringLength);
|
||||
|
||||
var r = "";
|
||||
while (true) {
|
||||
|
5
test/message/regress/regress-crbug-691194.js
Normal file
5
test/message/regress/regress-crbug-691194.js
Normal file
@ -0,0 +1,5 @@
|
||||
// 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.
|
||||
|
||||
"foo".repeat(1 << 30)
|
10
test/message/regress/regress-crbug-691194.out
Normal file
10
test/message/regress/regress-crbug-691194.out
Normal file
@ -0,0 +1,10 @@
|
||||
# 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.
|
||||
|
||||
*%(basename)s:5: RangeError: Invalid string length
|
||||
"foo".repeat(1 << 30)
|
||||
^
|
||||
RangeError: Invalid string length
|
||||
at String.repeat (native)
|
||||
at *%(basename)s:5:7
|
Loading…
Reference in New Issue
Block a user