-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.1.2
-
Component/s: None
-
None
While adding validation for journal and w=0 or w=-1 conflict for CDRIVER-580, I noticed that parsing for values of w less than -1 are ignored apart from a logged error. This means that URI parsing can still succeed.
I don't think it's possible to fail during _mongoc_uri_build_write_concern(), which stores parsed options on the write concern struct, as that function provides no API for relaying an error upstream. That's why my PR in CDRIVER-580 validated the write concern one level up in mongoc_uri_new().
That said, I think we could easily catch an invalid w value in mongoc_uri_parse_option(), which does allow us to return false on an error. The relevant code segment would be:
if (*value == '-' || isdigit(*value)) { v_int = (int) strtol (value, NULL, 10); BSON_APPEND_INT32 (&uri->options, "w", v_int); }
- is related to
-
CDRIVER-580 Write concern with w=0 and j=true is a GLE op
- Closed
-
CDRIVER-628 Deprecate MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED
- Closed
- related to
-
CDRIVER-782 Allow more detailed error reporting for failed URI parsing
- Closed