[SERVER-27097] Coverity analysis defect 100050: Dereference null return value Created: 17/Nov/16  Updated: 19/Nov/16  Resolved: 17/Nov/16

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: None
Fix Version/s: 3.4.0-rc4, 3.5.1

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

Issue Links:
Related
is related to SERVER-24596 Deadlock waiting for majority snapsho... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Query 2016-11-21
Participants:

 Description   

Return value of function which returns null is dereferenced without checking

Defect 100050 (STATIC_C)
Checker NULL_RETURNS (subcategory none)
File: /src/mongo/db/commands/mr.cpp
Function mongo::mr::<unnamed>::collectionCount(mongo::OperationContext *, const std::_cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, bool)
/src/mongo/db/commands/mr.cpp, line: 617
Assigning: "db" = null return value from "get".

            Database* db = dbHolder().get(txn, ns);



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

Author:

{u'username': u'm-vojvodic', u'name': u'Marko Vojvodic', u'email': u'marko.vojvodic@mongodb.com'}

Message: SERVER-27097 Check that db is not null before derefencing in _collectionCount
Branch: v3.4
https://github.com/mongodb/mongo/commit/8ab19a65f361a2f0fed4d788368b296f42e43495

Comment by Githook User [ 17/Nov/16 ]

Author:

{u'username': u'm-vojvodic', u'name': u'Marko Vojvodic', u'email': u'marko.vojvodic@mongodb.com'}

Message: SERVER-27097 Check that db is not null before derefencing in _collectionCount
Branch: master
https://github.com/mongodb/mongo/commit/f948e73df5148039b2fc8643a14635d9d982be7a

Generated at Thu Feb 08 04:14:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.