[SERVER-68818] Coverity analysis defect 122782: Dereference after null check Created: 14/Aug/22  Updated: 29/Oct/23  Resolved: 08/Nov/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Improvement Priority: Minor - P4
Reporter: Coverity Collector User Assignee: Sebastien Mendez
Resolution: Fixed Votes: 0
Labels: coverity, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-08-17 at 10.06.15 AM.png    
Backwards Compatibility: Fully Compatible
Sprint: QE 2022-10-17, QE 2022-10-31, QE 2022-11-14
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/exec/sbe/stages/hash_agg.cpp:360: FORWARD_NULL 122782 Calling "this->_recordStore.operator bool()" implies that "this->_recordStore" might be null-like.
/src/mongo/db/exec/sbe/stages/hash_agg.cpp:391: FORWARD_NULL 122782 Attempting to access the managed object of an empty smart pointer "this->_recordStore".



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

Author:

{'name': 'Sebastien Mendez', 'email': 'sebastien.mendez@mongodb.com', 'username': 'rakiz'}

Message: SERVER-68818 Restructured Hash Aggregation stage open() method to prevent null pointer dereference
Branch: master
https://github.com/mongodb/mongo/commit/c216085f5c9364440eee457e3d5d1ca9ff0d2a40

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