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

Probable readv crash when creating non-contiguous GridFS chunks

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.0-rc0
    • Affects Version/s: None
    • Component/s: GridFS
    • Labels:
    • Fully Compatible

      One can seek past the end of a GridFS file and proceed to write:

      mongoc_gridfs_file_seek (file, 1024 * 32, SEEK_END)
      mongoc_gridfs_file_writev (file, iov, iovcnt, timeout_msec);
      

      However, performing a mongoc_gridfs_file_readv() in the "gap space" will likely end in a crash. The C Driver needs to decide how it wants to handle this, consistent with the GridFS spec. Perhaps a reasonable approach is to:

      1. Seek past the end of the file.
      2. On performing any I/O operation, fill in the missing chunks with zero bytes, similar to the behavior of fseek(2) and writev(2).

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: