[CDRIVER-2834] Some URI parsing errors do not set the bson_error_t. Created: 22/Sep/18  Updated: 28/Oct/23  Resolved: 08/Oct/18

Status: Closed
Project: C Driver
Component/s: libmongoc, uri
Affects Version/s: None
Fix Version/s: 1.14.0

Type: Bug Priority: Minor - P4
Reporter: Kevin Albertson Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

mongoc_uri_new_with_error should set the passed bson_error_t on parsing error.

The following two cases do not set the error (and only log a warning).

mongodb://localhost/db?heartbeatfrequencyms=10 logs:

Invalid "heartbeatfrequencyms" of 10: must be at least 500

but does not set the error.

mongodb://localhost/db?zlibcompressionlevel=10 logs:

Invalid "zlibcompressionlevel" of 10: must be between -1 and 9

but does not set the error.

These are both validated internally with mongoc_uri_set_option_as_int32, which does not take a bson_error_t.

Let's make an internal _mongoc_uri_set_option_as_int32_with_error to pull the error out.



 Comments   
Comment by Githook User [ 08/Oct/18 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: CDRIVER-2834 report all errors from URI parsing
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/327b132a866de05da51047e124eac88d590f43f0

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