NSJSONSerialization Crashes on Dup Field Names

Originator:kirby
Number:rdar://13256524 Date Originated:2/20/2013
Status:Duplicate/12830961 Resolved:
Product:iOS SDK Product Version:6.0
Classification:Crash Reproducible:Always
 
Summary:

A duplicate field name at the same level in a JSON block can cause NSJSONSerialization to crash. 

Steps to Reproduce:

1. Run the attached sample project. 
2. The file test.json contains the JSON that will cause the crash.
3. The crash is caused multiple occurrences of the field "points" at the same level in the JSON.
4. Remove the extra "points" fields and NSJSONSerialization no longer crashes.

Expected Results:

Expect NSJSONSerialization to either 1) report the format error, or 2) ignore the duplicate field.

Actual Results:

NSJSONSerialization crashes.

Regression:

Notes:

Having duplicate fields at the same level does not always cause the crash. However, test.json in the sample project does always crash. So the crash is related to the sequence of events that occur when parsing this particular JSON data.

Sample project and crash report  uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!