_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.
- related to
-
CDRIVER-1896 Coverity analysis defect 76624: Side effect in assertion
- Closed