[SERVER-75021] Coverity analysis defect 135525: Dereference null return value Created: 19/Mar/23 Updated: 29/Oct/23 Resolved: 29/Mar/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Coverity Collector User | Assignee: | Antonio Fuschetto |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | coverity | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Sharding EMEA
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Sprint: | Sharding EMEA 2023-04-03 | ||||||||
| Participants: | |||||||||
| Description |
|
Dereference null return value If the function actually returns a null value, a null pointer dereference will occur. Return value of function which returns null is dereferenced without checking |
| Comments |
| Comment by Githook User [ 29/Mar/23 ] |
|
Author: {'name': 'Antonio Fuschetto', 'email': 'antonio.fuschetto@mongodb.com', 'username': 'afuschetto'}Message: |
| Comment by Antonio Fuschetto [ 29/Mar/23 ] |
|
The defect raised by Coverity is based on the fact that the CollectionCatalog iterator could refer to nullptr when the end of the catalog is reached or the database doesn't match. It is therefore a case that should never occur in an usual iteration from the first to the last element. I noticed that in other cases there it has been implemented a check (e.g., here and here) to keep Coverity happy. |