Index: src/typedarray.js |
diff --git a/src/typedarray.js b/src/typedarray.js |
index fc3a608f46ff83afd30b4b1108ac1f24e2419602..e15c4c17b13c31423e23d047eb1684882da6e005 100644 |
--- a/src/typedarray.js |
+++ b/src/typedarray.js |
@@ -98,6 +98,9 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) |
function NAMEConstructByArrayLike(obj, arrayLike) { |
var length = arrayLike.length; |
var l = ToPositiveInteger(length, "invalid_typed_array_length"); |
+ if (l > %MaxSmi()) { |
+ throw MakeRangeError("invalid_typed_array_length"); |
+ } |
if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) { |
for (var i = 0; i < l; i++) { |
// It is crucial that we let any execptions from arrayLike[i] |