[GODRIVER-1502] Extended JSON parsing mishandles invalid $code Created: 29/Feb/20  Updated: 28/Oct/23  Resolved: 13/Mar/20

Status: Closed
Project: Go Driver
Component/s: JSON & ExtJSON
Affects Version/s: 1.3.0
Fix Version/s: 1.3.2

Type: Bug Priority: Major - P3
Reporter: David Golden Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When parsing this document:

{"":{"$code":"", "0":{}}}

The follow error is received: "invalid JSON input; expected value for javascript". This should error due to an erroneous key next to $code.

This document fails to error and produces an incorrect document:

{"":{"$code":"abc", "0":""}}
0c0000000d00010000000000

Note that "abc" does not appear in the output.
 



 Comments   
Comment by Githook User [ 13/Mar/20 ]

Author:

{'name': 'Divjot Arora', 'username': 'divjotarora', 'email': 'divjot.arora@10gen.com'}

Message: GODRIVER-1502 Fix variable shadowing in parsing (#332)
Branch: release/1.3
https://github.com/mongodb/mongo-go-driver/commit/4ce14d470b166404dd9a2a0b3f858f4fc5783ff3

Comment by Githook User [ 13/Mar/20 ]

Author:

{'name': 'Divjot Arora', 'username': 'divjotarora', 'email': 'divjot.arora@10gen.com'}

Message: GODRIVER-1502 Fix variable shadowing in parsing (#332)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/32aba96df4f54d849a0ac7d4bb19412fe4e7c278

Comment by Divjot Arora (Inactive) [ 11/Mar/20 ]

https://github.com/mongodb/mongo-go-driver/pull/332

Generated at Thu Feb 08 08:36:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.