Add example of validating BSON nesting depth with bson_visitor_t

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 1.14.0
    • Affects Version/s: 1.9.4
    • Component/s: Docs, libmongoc
    • Environment:
      Windows 10
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Original title: "Calling mongoc_collection_insert with a document which contains hundreds of levels of nested BSON documents causes stack overflow"

      I know that MongoDB only supports up to 100 levels of nesting for BSON documents but if someone unknowingly calls mongoc_collection_insert() and passes a document with >500 levels of nesting, then it causes stack overflow.

       

      The overflow happens while validating the BSON document. If I disable the validation by passing in MONGOC_INSERT_NO_VALIDATE, then of course, it doesn't crash.

       

      I understand that this is unsupported behavior, but it would be nice if it didn't cause stack overflow.

              Assignee:
              Kevin Albertson
              Reporter:
              Bh Sr
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: