[SERVER-64293] Coverity analysis defect 121640: Unchecked dynamic_cast Created: 07/Mar/22  Updated: 29/Oct/23  Resolved: 08/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: Ted Tuckman
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-03-07 at 1.11.17 PM.png    
Issue Links:
Problem/Incident
is caused by SERVER-62535 Add ability to return multiple cursor... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Unchecked dynamic_cast

If the dynamic_cast fails, a null pointer dereference will occur; if the dynamic_cast cannot fail, using static_cast instead offers better performance. Dynamic_cast may fail and return null if the type cast is incompatible
/src/mongo/db/modules/enterprise/src/search/mongot_cursor.cpp:100: FORWARD_NULL 121640 Dynamic cast to pointer "dynamic_cast <mongo::DocumentSourceInternalSearchMongotRemote *>(potentialSearchStage.get())" can return "NULL".
/src/mongo/db/modules/enterprise/src/search/mongot_cursor.cpp:100: FORWARD_NULL 121640 Assigning: "origSearchStage" = "dynamic_cast <mongo::DocumentSourceInternalSearchMongotRemote *>(potentialSearchStage.get())".



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

Author:

{'name': 'Ted Tuckman', 'email': 'ted.tuckman@mongodb.com', 'username': 'TedTuckman'}

Message: SERVER-64293 Fix coverity issue in mongot_cursor
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/68b08f13dd61c604ac7a8e4a12a331015de9bdad

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