[CDRIVER-1878] bson_append_code_with_scope drops empty scope Created: 23/Oct/16  Updated: 27/Dec/16  Resolved: 27/Oct/16

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: None
Fix Version/s: 1.5.0

Type: Bug Priority: Minor - P4
Reporter: David Golden Assignee: Backlog - C Driver Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-1335 libbson does not properly serialize t... Closed
Related
related to CDRIVER-1879 libbson truncates code_with_scope wit... Closed
related to PHPC-714 Implement BSON corpus test suite Closed

 Description   

If the scope is empty, bson_append_code_with_scope delegates instead to bson_append_code, changing the requested type.

This behavior is undocumented.

The offending lines appear to be 955-957 in bson.c:

   if (bson_empty0 (scope)) {
      return bson_append_code (bson, key, key_length, javascript);
   }



 Comments   
Comment by Jeremy Mikola [ 27/Dec/16 ]

Marking as a duplicate of CDRIVER-1335, of which CDRIVER-1364 was a duplicate.

Comment by David Golden [ 23/Oct/16 ]

Yes, apparently it is.

I have some workaround patches I've been using in my vended copy of libbson for the Perl BSON::XS module for the various tickets I'm filing. I'm not 100% confident in them, but I'm happy to go through them with you at some point as they are probably 80-90% correct and I'd welcome more feedback.

Comment by A. Jesse Jiryu Davis [ 23/Oct/16 ]

Thanks for these BSON tickets. =) Is this one a duplicate of CDRIVER-1364?

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