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

Side by Side Diff: test/mjsunit/regress/regress-581.js

Issue 1278703003: Fix off-by-one in Array.concat's max index check (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/regress/regress-crbug-516592.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 var pow31 = Math.pow(2, 31); 29 var pow31 = Math.pow(2, 31);
30 30
31 var a = []; 31 var a = [];
32 a[pow31] = 31; 32 a[pow31] = 31;
33 33
34 assertEquals(pow31 + 1, a.length); 34 assertEquals(pow31 + 1, a.length);
35 assertThrows(function() { a.concat(a); }, RangeError); 35 assertThrows(function() { a.concat(a); }, RangeError);
36 36
37 var b = []; 37 var b = [];
38 b[pow31 - 3] = 32; 38 b[pow31 - 3] = 32;
39 b[pow31 - 2] = "out_of_bounds";
40 var ab = a.concat(b); 39 var ab = a.concat(b);
41 assertEquals(2 * pow31 - 1, ab.length); 40 assertEquals(2 * pow31 - 1, ab.length);
42 assertEquals(31, ab[pow31]); 41 assertEquals(31, ab[pow31]);
43 assertEquals(32, ab[2 * pow31 - 2]); 42 assertEquals(32, ab[2 * pow31 - 2]);
44 assertEquals(undefined, ab[2 * pow31 - 1]); 43 assertEquals(undefined, ab[2 * pow31 - 1]);
45 44
46 var c = []; 45 var c = [];
47 c[pow30] = 30; 46 c[pow30] = 30;
48 assertThrows(function() { c.concat(c, a); }, RangeError); 47 assertThrows(function() { c.concat(c, a); }, RangeError);
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/regress/regress-crbug-516592.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698