Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r230101 - Out-of-bounds accesses due to a missing check for MAX…
…_STORAGE_VECTOR_LENGTH in unshiftCountForAnyIndexingType https://bugs.webkit.org/show_bug.cgi?id=183657 JSTests: Reviewed by Keith Miller. * stress/large-unshift-splice.js: Added. (make_contig_arr): Source/JavaScriptCore: <rdar://problem/38464399> Reviewed by Keith Miller. There was just a missing check in unshiftCountForIndexingType. I've also replaced 'return false' by 'return true' in the case of an 'out-of-memory' exception, because 'return false' means 'please continue to the slow path', and the slow path has an assert that there is no unhandled exception (line 360 of ArrayPrototype.cpp). Finally, I made the assert in ensureLength a release assert as it would have caught this bug and prevented it from being a security risk. * runtime/ArrayPrototype.cpp: (JSC::unshift): * runtime/JSArray.cpp: (JSC::JSArray::unshiftCountWithAnyIndexingType): * runtime/JSObject.h: (JSC::JSObject::ensureLength):
- Loading branch information
1 parent
cea5df2
commit f7f3699
Showing
6 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//@ skip if $memoryLimited | ||
|
||
function make_contig_arr(sz) | ||
{ | ||
let a = []; | ||
while (a.length < sz / 8) | ||
a.push(3.14); | ||
a.length *= 8; | ||
return a; | ||
} | ||
|
||
let ARRAY_LENGTH = 0x10000000; | ||
let a = make_contig_arr(ARRAY_LENGTH); | ||
let b = make_contig_arr(0xff00); | ||
b.unshift(a.length-0x10000, 0); | ||
Array.prototype.splice.apply(a, b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters