[SERVER-71913] nullptr dereference in CollectionImpl::initFromExisting Created: 06/Dec/22  Updated: 29/Oct/23  Resolved: 13/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: Matthew Saltz (Inactive) Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
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   

We use collection here without checking if it's nullptr. But in CollectionCatalog::_createNewPITCollection we call initFromExisting with nullptr. This causes a segmentation fault.

At the very least we should avoid dereferencing collection if it's nullptr.

But I think we probably actually shouldn't be calling a function initFromExisting with something that's not existing. I was actually confused the first time I came across the call site because of that. So we could also instead have an `CollectionImpl::init` function that takes a read timestamp, and use that.



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

Author:

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

Message: SERVER-71913 Fix nullptr dereference in CollectionImpl::initFromExisting()
Branch: master
https://github.com/mongodb/mongo/commit/50e6eef76ebb58672e0e23c3ac824491d3cb5a35

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