[SERVER-71804] Coverity analysis defect 134265: Dereference after null check Created: 02/Dec/22  Updated: 29/Oct/23  Resolved: 12/Dec/22

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2022-12-26
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/collection_catalog.cpp:788: FORWARD_NULL 134265 Calling "pendingCollection->operator bool()" implies that "pendingCollection" might be null-like.
/src/mongo/db/catalog/collection_catalog.cpp:805: FORWARD_NULL 134265 Attempting to access the managed object of an empty smart pointer "pendingCollection".



 Comments   
Comment by Githook User [ 12/Dec/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-71804 Fix dereference after null check in CollectionCatalog::openCollection()
Branch: master
https://github.com/mongodb/mongo/commit/5753880639b81ec0dcd5c2abcf2165abd86773b1

Generated at Thu Feb 08 06:20:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.