[CDRIVER-184] Core dump in bson_append_string Created: 21/Nov/12  Updated: 11/Nov/13  Resolved: 11/Nov/13

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.6
Fix Version/s: 0.90.0

Type: Bug Priority: Major - P3
Reporter: Rick Stevens Assignee: Gary Murakami
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 6.3, Fedora 17



 Description   

When using bson_append_string(), if the string you're appending is null the function segfaults. Example code:

bson_append_string(obj, "Field", fields[x]);

If "fields[x]" evaluates to a null pointer, the function will segfault. It's an easy workaround (check values before passing to the function), but it was a bit of a surprise when it happened.



 Comments   
Comment by Christian Hergert [ 09/Nov/13 ]

I would suggest migrating to our new code-base, libbson. It is much faster, well tested, and includes robust fail-safe checks.

https://github.com/mongodb/libbson

Comment by Gary Murakami [ 07/Jan/13 ]

Should it check, print a diagnostic, and exit?

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