[CDRIVER-3513] Fix instances where functions may return false without setting the out bson_error_t Created: 31/Jan/20 Updated: 28/Oct/23 Resolved: 01/Jul/20 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.17.0-rc0, 1.17.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kevin Albertson | Assignee: | Andrew Witten (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | codeql, new-eng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
A common pattern for functions in libmongoc is to return a boolean and have an out parameter bson_error_t. If the return value is false, callers can assume the bson_error_t was set. In the past, we've discovered bugs due to code not abiding by this contract (e.g. The following cases appear to be times where functions return false without setting the out bson_error_t param when they should be:
Instances were found using this CodeQL query and skimming through the 54 results:
Can be run here (or locally): https://lgtm.com/query/8792356789210846853/ |
| Comments |
| Comment by Githook User [ 11/Jul/20 ] |
|
Author: {'name': 'Andrew Witten', 'email': 'andrew.witten@mongodb.com', 'username': 'awitten1'}Message: saved errors and added test case |
| Comment by Githook User [ 01/Jul/20 ] |
|
Author: {'name': 'Andrew Witten', 'email': 'andrew.witten@mongodb.com', 'username': 'awitten1'}Message: saved errors and added test case |
| Comment by Andrew Witten (Inactive) [ 29/Jun/20 ] |