Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/typedarray.js

Issue 73943004: Limit the size for typed arrays to MaxSmi. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix for message and reduced memory reqs in test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress/regress-319722-ArrayBuffer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typedarray.js
diff --git a/src/typedarray.js b/src/typedarray.js
index 422dc4a03cba36b8a422b5913babaafe1c83bb06..ca87f8b62ac0d6b48bbd6715972ee3253d1fe457 100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -87,6 +87,9 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
function NAMEConstructByLength(obj, length) {
var l = IS_UNDEFINED(length) ?
0 : ToPositiveInteger(length, "invalid_typed_array_length");
+ if (l > %MaxSmi()) {
+ throw MakeRangeError("invalid_typed_array_length");
+ }
var byteLength = l * ELEMENT_SIZE;
var buffer = new $ArrayBuffer(byteLength);
%TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress/regress-319722-ArrayBuffer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698