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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.5
    • 0.4
    • None
    • None
    • Visual Studio 2005, Windows, release mode compilation

    Description

      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.

      Attachments

        Activity

          People

            kbanker Kyle Banker
            mattp Matthew Proujansky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: