[CDRIVER-848] Probable readv crash when creating non-contiguous GridFS chunks Created: 16/Sep/15  Updated: 30/Nov/15  Resolved: 25/Sep/15

Status: Closed
Project: C Driver
Component/s: GridFS
Affects Version/s: None
Fix Version/s: 1.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Duplicate Votes: 0
Labels: gridfs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-870 Handle GridFS I/O operations beyond e... Closed
Related
related to CDRIVER-870 Handle GridFS I/O operations beyond e... Closed
Backwards Compatibility: Fully Compatible

 Description   

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).



 Comments   
Comment by Kyle Suarez [ 25/Sep/15 ]

When CDRIVER-870 is completed, it will no longer be possible to create non-contiguous GridFS files, which solves this issue.

Generated at Wed Feb 07 21:10:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.