[SERVER-72831] Fix use after move in sharding_util::processShardResponses Created: 13/Jan/23  Updated: 29/Oct/23  Resolved: 16/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.3.0-rc4, 6.0.3, 6.1.0-rc4, 6.2.0-rc6
Fix Version/s: 6.3.0-rc0, 6.0.5

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

Issue Links:
Backports
Problem/Incident
is caused by SERVER-60694 Create DDL coordinator for collMod co... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.2, v6.0
Sprint: Sharding EMEA 2023-01-23
Participants:

 Description   

In sharding_util::processShardResponses we std::move part of the response and then we std::move again the entire response object.

This is not causing invalid memory access because the RemoteCommandResponse class doesn't have a move constructor, thus the first std::move is actually making a copy of the object.



 Comments   
Comment by Githook User [ 16/Jan/23 ]

Author:

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

Message: SERVER-72831 Fix use after move in sharding_util::processShardResponses

(cherry picked from commit 4aac2a59f897c64974ec72ddc8aa299e2540c8ab)
Branch: v6.0
https://github.com/mongodb/mongo/commit/9d8cd2d511f4bda9ae98c3d933b5592869013a3d

Comment by Githook User [ 16/Jan/23 ]

Author:

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

Message: SERVER-72831 Fix use after move in sharding_util::processShardResponses
Branch: master
https://github.com/mongodb/mongo/commit/4aac2a59f897c64974ec72ddc8aa299e2540c8ab

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