Title: [251394] trunk
- Revision
- 251394
- Author
- [email protected]
- Date
- 2019-10-21 16:23:37 -0700 (Mon, 21 Oct 2019)
Log Message
JSON.parse has bad is array assert
https://bugs.webkit.org/show_bug.cgi?id=203207
<rdar://problem/56366913>
Reviewed by Yusuke Suzuki.
JSTests:
* stress/json-parse-array-prototype-is-array-assert.js: Added.
(assert):
Source/_javascript_Core:
In r250860, we updated JSON.parse to be more spec compliant with how it
handles arrays. However, we also updated an assertion in an improper way,
where our assert was not accounting for the check we performed to take
that control flow path.
* runtime/JSONObject.cpp:
(JSC::Walker::walk):
Modified Paths
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (251393 => 251394)
--- trunk/JSTests/ChangeLog 2019-10-21 23:17:17 UTC (rev 251393)
+++ trunk/JSTests/ChangeLog 2019-10-21 23:23:37 UTC (rev 251394)
@@ -1,3 +1,14 @@
+2019-10-21 Saam Barati <[email protected]>
+
+ JSON.parse has bad is array assert
+ https://bugs.webkit.org/show_bug.cgi?id=203207
+ <rdar://problem/56366913>
+
+ Reviewed by Yusuke Suzuki.
+
+ * stress/json-parse-array-prototype-is-array-assert.js: Added.
+ (assert):
+
2019-10-21 Robin Morisset <[email protected]>
Throw the right exception upon memory exhaustion in Array::slice
Added: trunk/JSTests/stress/json-parse-array-prototype-is-array-assert.js (0 => 251394)
--- trunk/JSTests/stress/json-parse-array-prototype-is-array-assert.js (rev 0)
+++ trunk/JSTests/stress/json-parse-array-prototype-is-array-assert.js 2019-10-21 23:23:37 UTC (rev 251394)
@@ -0,0 +1,28 @@
+function assert(b) {
+ if (!b)
+ throw new Error;
+}
+
+assert(JSON.stringify(JSON.parse('[1337,42]', function (x, y) {
+ if (this instanceof Array) {
+ Object.defineProperty(this, '1', {value: Array.prototype});
+ return y;
+ }
+ return this;
+})) === '{"":[1337,[]]}');
+
+assert(JSON.stringify(JSON.parse('[0, 1]', function(x, y) {
+ this[1] = Array.prototype;
+ return y;
+})) === '[0,[]]');
+
+assert(JSON.stringify(JSON.parse('{"x":22, "y":44}', function(a, b) {
+ this.y = Array.prototype;
+ return b;
+})) === '{"x":22,"y":[]}');
+
+Array.prototype[0] = 42;
+assert(JSON.stringify(JSON.parse('{"x":22, "y":44}', function(a, b) {
+ this.y = Array.prototype;
+ return b;
+})) === '{"x":22,"y":[42]}');
Modified: trunk/Source/_javascript_Core/ChangeLog (251393 => 251394)
--- trunk/Source/_javascript_Core/ChangeLog 2019-10-21 23:17:17 UTC (rev 251393)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-10-21 23:23:37 UTC (rev 251394)
@@ -1,3 +1,19 @@
+2019-10-21 Saam Barati <[email protected]>
+
+ JSON.parse has bad is array assert
+ https://bugs.webkit.org/show_bug.cgi?id=203207
+ <rdar://problem/56366913>
+
+ Reviewed by Yusuke Suzuki.
+
+ In r250860, we updated JSON.parse to be more spec compliant with how it
+ handles arrays. However, we also updated an assertion in an improper way,
+ where our assert was not accounting for the check we performed to take
+ that control flow path.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Walker::walk):
+
2019-10-21 Robin Morisset <[email protected]>
Throw the right exception upon memory exhaustion in Array::slice
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (251393 => 251394)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2019-10-21 23:17:17 UTC (rev 251393)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2019-10-21 23:23:37 UTC (rev 251394)
@@ -664,7 +664,9 @@
arrayStartState:
case ArrayStartState: {
ASSERT(inValue.isObject());
- ASSERT(isJSArray(inValue) || inValue.inherits<ProxyObject>(vm));
+ ASSERT(isArray(m_exec, inValue));
+ EXCEPTION_ASSERT(!scope.exception());
+
if (markedStack.size() > maximumFilterRecursion)
return throwStackOverflowError(m_exec, scope);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes