Repository navigation
Commit e4e335c
committed
[JSC] Read Array newTarget.prototype before an invalid-length RangeError
https://bugs.webkit.org/show_bug.cgi?id=325494
Reviewed by Yusuke Suzuki.
A single numeric argument is checked with ToUint32 before
GetPrototypeFromConstructor. When that length is not a safe integer
index, the RangeError is thrown without reading newTarget.prototype,
so a throwing getter never runs.
The length is already a number here, so the conversion itself has no
side effect. Read prototype, and GetFunctionRealm when the result is
not an object, before throwing.
* JSTests/stress/array-constructor-length-after-prototype.js: Added.
* Source/JavaScriptCore/runtime/ArrayConstructor.cpp:
(JSC::constructArrayWithSizeQuirk):
Canonical link: https://commits.webkit.org/322282@main1 parent 1b1238d commit e4e335c
2 files changed
Lines changed: 49 additions & 0 deletions
File tree
- JSTests/stress
- Source/JavaScriptCore/runtime
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
| |||
0 commit comments