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

Bugs in _mongoc_gridfs_file_extend

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.3.0
    • Component/s: GridFS, libmongoc
    • 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:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: