Reviewers: Yang,

Message:
PTAL

Description:
Fix escaped index JSON parsing

BUG=416449
LOG=y

Please review this at https://codereview.chromium.org/592813002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+3, -4 lines):
  M src/json-parser.h
  A + test/mjsunit/regress/regress-json-parse-index.js


Index: src/json-parser.h
diff --git a/src/json-parser.h b/src/json-parser.h
index caa2e14d2c311d2ab58566dba53753afaff47567..d3148c9e21ed295fb8d8bace1924eb080be2e680 100644
--- a/src/json-parser.h
+++ b/src/json-parser.h
@@ -426,8 +426,7 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
         if (value.is_null()) return ReportUnexpectedCharacter();
       }

-      JSObject::SetOwnPropertyIgnoreAttributes(
-          json_object, key, value, NONE).Assert();
+      Runtime::DefineObjectProperty(json_object, key, value, NONE).Check();
     } while (MatchSkipWhiteSpace(','));
     if (c0_ != '}') {
       return ReportUnexpectedCharacter();
Index: test/mjsunit/regress/regress-json-parse-index.js
diff --git a/test/mjsunit/regress/regress-crbug-351262.js b/test/mjsunit/regress/regress-json-parse-index.js
similarity index 72%
copy from test/mjsunit/regress/regress-crbug-351262.js
copy to test/mjsunit/regress/regress-json-parse-index.js
index a2f4eadc0de5c2bd7d27f6e78ff9940fce7b0f85..d1a785aaf1ef35714d5702be15cff74bfaa73521 100644
--- a/test/mjsunit/regress/regress-crbug-351262.js
+++ b/test/mjsunit/regress/regress-json-parse-index.js
@@ -2,5 +2,5 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-for (var x in this) {};
-JSON.stringify(this);
+var o = JSON.parse('{"\\u0030":100}');
+assertEquals(100, o[0]);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to