Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2814

No simple way to validate a BSON document without crashing

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.12.0
    • Component/s: libmongoc
    • None
    • Environment:
      Windows 10

      If I call bson_validate() with a document with more than 500 levels of nesting, it crashes.

      I had created a separate bug for insert (CDRIVER-2701) and the workaround suggested was too complicated and not very efficient. It seems strange to me that we need to validate the document before calling the validate function( whose job it is to say whether the document is valid or not) just to prevent it from crashing.

       

      So in effect, bson_validate() only works on already validated documents.

       

      I think this is a serious issue which needs to be fixed. I understand that there are inconsistencies in what MongoDB server does and what Extended JSON Spec says. But I think using the maximum depth of 180 like MongoDB server does is much better than letting it crash or requiring users to validate the document before calling bson_validate(). I don't think the change will make what the Extended JSON Spec any more untrue than what it is today.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            bhargavabhat@gmail.com Bh Sr
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: