[CDRIVER-2036] extjson parsing bug in 1.6.0 Created: 06/Feb/17  Updated: 03/May/17  Resolved: 07/Feb/17

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: 1.6.0
Fix Version/s: 1.7.0

Type: Bug Priority: Major - P3
Reporter: Jeroen Ooms [X] Assignee: A. Jesse Jiryu Davis
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CDRIVER-1947 Improve libbson compatibility with th... Closed
Epic Link: libbson corpus

 Description   

After upgrading the c driver to 1.6.0, some unit tests fail with:

> m$insert( '{"a" : [

{"$numberInt": "10"}

]}' )
Error: document to insert contains invalid keys



 Comments   
Comment by A. Jesse Jiryu Davis [ 06/Feb/17 ]

Thanks Jeroen. We haven't implemented the BSON Corpus tests yet, that's scheduled for 1.7.0. We haven't implemented everything in the new Extended JSON syntax required by those tests, either. So we don't have $numberInt (although we do have $numberLong), and we can't parse $timestamp as a numeric string (although we can parse it as a document with keys "i" and "t"). See CDRIVER-1947.

Comment by Jeroen Ooms [X] [ 06/Feb/17 ]

Below a few more examples of extjson strings from the specifications repository which fail in libbson 1.6.0:

{"a" : [{"$numberInt": "10"}]}
{"x" : {"" : "b"}}
{"d" : {"$numberDouble": "1.0"}}
{"a" : "ab\u0000bab\u0000babab"}
{"a" : {"$timestamp" : "530242871224172586"}}

Comment by Jeroen Ooms [X] [ 06/Feb/17 ]

In addition the timestamp test fails with:

> m$insert('{"a" : {"$timestamp" : "530242871224172586"}}')
Error: Invalid state to look for string 7

Generated at Wed Feb 07 21:13:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.