Skip to content
Snippets Groups Projects
Commit 0192e0d7 authored by Rick Waldron's avatar Rick Waldron Committed by Leo Balter
Browse files

TypedArrays with elementSize 1 cannot produce these range errors (#1465)

parent 1e1d503c
No related branches found
No related tags found
No related merge requests found
...@@ -12,10 +12,15 @@ info: | ...@@ -12,10 +12,15 @@ info: |
least one argument and the Type of the first argument is Object and that least one argument and the Type of the first argument is Object and that
object has an [[ArrayBufferData]] internal slot. object has an [[ArrayBufferData]] internal slot.
Let elementSize be the Number value of the Element Size value in Table 56 for constructorName.*
... ...
13. If length is undefined, then If length is either not present or undefined, then
a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception.
... ...
* Int8Array, Uint8Array, Uint8ClampedArray all have element size 1, so will never fail.
includes: [testTypedArray.js] includes: [testTypedArray.js]
features: [SharedArrayBuffer, TypedArray] features: [SharedArrayBuffer, TypedArray]
---*/ ---*/
...@@ -30,4 +35,4 @@ testWithTypedArrayConstructors(function(TA) { ...@@ -30,4 +35,4 @@ testWithTypedArrayConstructors(function(TA) {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
new TA(buffer, 0, undefined); new TA(buffer, 0, undefined);
}); });
}); }, [ Float64Array, Float32Array, Int32Array, Int16Array, Uint32Array, Uint16Array ]);
...@@ -12,9 +12,15 @@ info: | ...@@ -12,9 +12,15 @@ info: |
least one argument and the Type of the first argument is Object and that least one argument and the Type of the first argument is Object and that
object has an [[ArrayBufferData]] internal slot. object has an [[ArrayBufferData]] internal slot.
Let elementSize be the Number value of the Element Size value in Table 56 for constructorName.*
... ...
10. If offset modulo elementSize ≠ 0, throw a RangeError exception. If offset modulo elementSize ≠ 0, throw a RangeError exception.
... ...
* Int8Array, Uint8Array, Uint8ClampedArray all have element size 1, so will never fail.
includes: [testTypedArray.js] includes: [testTypedArray.js]
features: [SharedArrayBuffer, TypedArray] features: [SharedArrayBuffer, TypedArray]
---*/ ---*/
...@@ -25,4 +31,5 @@ testWithTypedArrayConstructors(function(TA) { ...@@ -25,4 +31,5 @@ testWithTypedArrayConstructors(function(TA) {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
new TA(buffer, 7); new TA(buffer, 7);
}); });
}); }, [ Float64Array, Float32Array, Int32Array, Int16Array, Uint32Array, Uint16Array ]);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment