[CDRIVER-1898] Crash in APM with mongoc_client_kill_cursor Created: 02/Nov/16  Updated: 07/Nov/16  Resolved: 07/Nov/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5.0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The deprecated function mongoc_client_kill_cursor does not pass database or collection name, but if an APM callback is registered for "command started", it attempts to dereference the database and collection name.

This function is deprecated so just skip APM.

Coverity report:

Defect 99992 (STATIC_C)
Checker FORWARD_NULL (subcategory none)
File: /src/mongoc/mongoc-client.c
Function _mongoc_client_kill_cursor
/src/mongoc/mongoc-client.c, line: 1638
Comparing "db" to null implies that "db" might be null.

       if (db && collection &&



 Comments   
Comment by Githook User [ 07/Nov/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1898 crash in mongoc_client_kill_cursor

If an APM "command started" callback is registered, the null database
and collection names from mongoc_client_kill_cursor causes a crash.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/3349d54c9d03b1db5ec1a900ca4ba0e345d7ea41

Comment by Hannes Magnusson [ 02/Nov/16 ]

This is in the apm which requires database name in the event.
However, mongoc_client_kill_cursor intentionally does never specify database

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