[CDRIVER-1921] mongoc_cursor_new_from_command_reply fails with static bson reply Created: 16/Nov/16 Updated: 27/Nov/16 Resolved: 17/Nov/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Golden | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
mongoc_cursor_new_from_command_reply() internally eventually calls bson_steal() on the provided reply bson_t pointer and does not check it's return value. bson_steal fails for read-only bson_t structures, so mongoc_cursor_new_from_command_reply fails to take ownership of the provided bson. Sample failing test is here:
Some possible options for fixes:
For example, a trivial fix (though one that still doesn't check the final bson_steal return value):
|
| Comments |
| Comment by Githook User [ 27/Nov/16 ] |
|
Author: {u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}Message: |
| Comment by Githook User [ 17/Nov/16 ] |
|
Author: {u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}Message: |
| Comment by Githook User [ 17/Nov/16 ] |
|
Author: {u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}Message: |
| Comment by David Golden [ 17/Nov/16 ] |
| Comment by A. Jesse Jiryu Davis [ 17/Nov/16 ] |
|
LGTM, want to submit a PR? We can include in 1.5.0. |
| Comment by David Golden [ 16/Nov/16 ] |
|
Code available as https://github.com/xdg/mongo-c-driver/commit/899baf78ec9b0e94389c14e46b0edc7b994bbf81 if desired. |