Commit 96cd1cfb authored by Franziska Hinkelmann's avatar Franziska Hinkelmann Committed by Commit Bot

[es2015] Fix error for wrong offset in TypedArray

%TypedArray%.prototype.set should throw a range error for invalid offset.

Bug: v8:6729
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I2b2b64a82657ecabf136ec8f13b41e95a62b8f38
Reviewed-on: https://chromium-review.googlesource.com/620569
Commit-Queue: Franziska Hinkelmann <franzih@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47443}
parent b6059a67
......@@ -254,7 +254,7 @@ DEFINE_METHOD_LEN(
GlobalTypedArray.prototype,
set(obj, offset) {
var intOffset = IS_UNDEFINED(offset) ? 0 : TO_INTEGER(offset);
if (intOffset < 0) throw %make_type_error(kTypedArraySetNegativeOffset);
if (intOffset < 0) throw %make_range_error(kTypedArraySetNegativeOffset);
if (intOffset > %_MaxSmi()) {
throw %make_range_error(kTypedArraySetSourceTooLarge);
......
// 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.
let a = new Uint8Array(16);
a.set([2], -1);
# 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:6: RangeError: Start offset is negative
a.set([2], -1);
^
RangeError: Start offset is negative
at Uint8Array.set (native)
at *%(basename)s:6:3
\ No newline at end of file
......@@ -332,8 +332,6 @@
'intl402/NumberFormat/prototype/formatToParts/*': ['--harmony-number-format-to-parts'],
# https://bugs.chromium.org/p/v8/issues/detail?id=5327
'built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws': [FAIL],
'built-ins/TypedArray/prototype/set/typedarray-arg-negative-integer-offset-throws': [FAIL],
'built-ins/TypedArrays/internals/Set/key-is-minus-zero': [FAIL],
'built-ins/TypedArrays/internals/Set/key-is-not-integer': [FAIL],
'built-ins/TypedArrays/internals/Set/key-is-out-of-bounds': [FAIL],
......
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