bson object should not be initialized in an assert—release mode code does not compile asserts

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 0.5
    • Affects Version/s: 0.4
    • Component/s: None
    • None
    • Environment:
      Visual Studio 2005, Windows, release mode compilation
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In mongodb-mongo-c-driver-1380839, version 0.4, in the file gridfs.c, line 129 is:
      assert( mongo_run_command( gfs->client, gfs->dbname, &command, &res ) == MONGO_OK );

      When compiling this code in Visual Studio 2005 (and presumably other compilers), in debug mode the assert is compiled, but in release mode the assert is ignored.

      Therefore, in release mode the bson object "res" is not initialized, and when "res" is used on line 141:
      bson_find( &it, &res, "md5" );

      the code will crash.

      Initializing "res" should be done outside the assert.

            Assignee:
            Kyle Banker (Inactive)
            Reporter:
            Matthew Proujansky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: