bson_validate functions are broken by strings/keys that are not valid UTF-8

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 2.0.2, 1.30.5, 2.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Needed
    • None
    • Minor Change
    • C Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      The BSON_VALIDATE_UTF8 flag requests that the bson_validate family of functions check the content of UTF-8 text elements for byte sequences that are not valid UTF-8. This flag never has any effect, because the bson_iter_visit_all function checks for invalid UTF-8 before the validating visitor gets a chance to inspect the element content.

      bson_iter_visit_all sets an err_off on the iterator, but the validation functions do not check this value. Instead, they halt early on invalid UTF-8 sequences, and then report success. This is also a problem when keys contain invalid UTF-8, because the visitor still does not see the element and does not inspect iter.err_off.

            Assignee:
            Colby Pike
            Reporter:
            Colby Pike
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: