mongoc_client_get_gridfs() may generate segfault internally.
For example:
#include <mongoc.h> int main() { mongoc_client_t *client; mongoc_gridfs_t *gridfs; bson_error_t error; mongoc_init(); client = mongoc_client_new("mongodb://INVALID-URI"); BSON_ASSERT(client); gridfs = mongoc_client_get_gridfs(client, "test-gridfs", 0, &error); BSON_ASSERT(!gridfs); mongoc_client_destroy(client); mongoc_cleanup(); return 0; }
Output:
$ ./a.out Segmentation fault
Valgrind's output:
==10844== Invalid read of size 8 ==10844== at 0x4E4D144: mongoc_cluster_run_command_monitored (mongoc-cluster.c:362) ==10844== by 0x4E521BA: mongoc_collection_create_index_with_opts (mongoc-collection.c:1325) ==10844== by 0x4E528AF: mongoc_collection_create_index (mongoc-collection.c:1155) ==10844== by 0x4E5CCBE: _mongoc_gridfs_ensure_index (mongoc-gridfs.c:66) ==10844== by 0x4E5CCBE: _mongoc_gridfs_new (mongoc-gridfs.c:133) ==10844== by 0x400887: main (libmongoc5.c:12) ==10844== Address 0x8 is not stack'd, malloc'd or (recently) free'd ==10844== ==10844== ==10844== Process terminating with default action of signal 11 (SIGSEGV) ==10844== Access not within mapped region at address 0x8 ==10844== at 0x4E4D144: mongoc_cluster_run_command_monitored (mongoc-cluster.c:362) ==10844== by 0x4E521BA: mongoc_collection_create_index_with_opts (mongoc-collection.c:1325) ==10844== by 0x4E528AF: mongoc_collection_create_index (mongoc-collection.c:1155) ==10844== by 0x4E5CCBE: _mongoc_gridfs_ensure_index (mongoc-gridfs.c:66) ==10844== by 0x4E5CCBE: _mongoc_gridfs_new (mongoc-gridfs.c:133) ==10844== by 0x400887: main (libmongoc5.c:12)
- is related to
-
CDRIVER-2034 test_create_index_fail error on zSeries Ubuntu without OpenSSL
- Closed