[SERVER-55210] Risk stack-use-after-scope error when getting const reference of value held in optional Created: 15/Mar/21  Updated: 29/Oct/23  Resolved: 16/Mar/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Lingzhi Deng
Resolution: Fixed Votes: 0
Labels: pm-1791_other_required
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2021-03-22
Participants:
Linked BF Score: 185

 Description   

This is the block of code that's problematic. getTxnNumber() and getStatementId() return by value and the operator* gets in the way so that the lifetime of the temporary optional is not extended.



 Comments   
Comment by Githook User [ 15/Mar/21 ]

Author:

{'name': 'Lingzhi Deng', 'email': 'lingzhi.deng@mongodb.com', 'username': 'ldennis'}

Message: SERVER-55210: Fix stack-use-after-scope in TenantOplogApplier
Branch: master
https://github.com/mongodb/mongo/commit/c56f50a217fb296f959de226c60f6f594b79281f

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