[SERVER-49947] Catalog Cache async task accesses un-owned StringData variable Created: 28/Jul/20  Updated: 29/Oct/23  Resolved: 29/Jul/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.5.1
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Tommaso Tocci
Resolution: Fixed Votes: 0
Labels: PM-1645-Milestone-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-49292 Futurify CatalogCacheLoader API Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2020-08-10
Participants:
Linked BF Score: 43

 Description   

Cache loader access un-owned variable causing use-after-free memory access error.
These are the two different places that implement this wrong pattern:

StringData object wraps a 'const std::string&' or a 'const char*' without copying its contents. Thus keeping alive the StringData object itself doesn't guarantee that the underlying char array won't be freed. For this reason when capturing such an object in an async task an explicit copy of the underlying data needs to be performed.



 Comments   
Comment by Githook User [ 29/Jul/20 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: SERVER-49947 Catalog Cache async task accesses un-owned StringData variable
Branch: master
https://github.com/mongodb/mongo/commit/9950c7db67a7034e700a33c983e991914ecafd3d

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