Bugs in _mongoc_gridfs_file_extend

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 1.5.0
    • Affects Version/s: 1.3.0
    • Component/s: GridFS, libmongoc
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      _mongoc_gridfs_file_extend has at least two clearly incorrect statements. First:

            /* Set bytes until we reach the limit or fill a page */
            file->pos += _mongoc_gridfs_file_page_memset0 (file->page,
                                                           target_length - file->pos);
      

      This is wrong because the return type of _mongoc_gridfs_file_page_memset0 is bool, and it is being added to a uint64_t. (Introduced in e2c174.) Second:

         BSON_ASSERT (file->length = target_length);
      

      This appears wrong because it is an assignment in an assert (CDRIVER-1896), but it is not compiled out in a release build any more (CDRIVER-697). The intention is mysterious.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: