[SERVER-63414] Coverity analysis defect 121491: Dereference after null check Created: 08/Feb/22  Updated: 29/Oct/23  Resolved: 22/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Yujin Kang Park
Resolution: Fixed Votes: 0
Labels: coverity, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2022-04-04
Participants:

 Description   

Dereference after null check

Either the check against null is unnecessary, or there may be a null pointer dereference. Pointer is checked against null but then dereferenced anyway
/src/mongo/db/catalog/create_collection.cpp:769: FORWARD_NULL 121491 Comparing "db" to null implies that "db" might be null.
/src/mongo/db/catalog/create_collection.cpp:776: FORWARD_NULL 121491 Passing null pointer "db" to "makeUniqueCollectionNamespace", which dereferences it. (The dereference happens because this is a virtual function call.)



 Comments   
Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}

Message: SERVER-63414 Change static cast to bool initializer.
Branch: master
https://github.com/mongodb/mongo/commit/fa453d00605087745dfc5a8c3f4bb553d745dd70

Generated at Thu Feb 08 05:57:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.