From e126e454038549d51ebc620f9f40d5c55f159cb8 Mon Sep 17 00:00:00 2001 From: Tal Benesh Date: Mon, 15 Jan 2024 03:43:03 -0800 Subject: [PATCH] Fixing unspecified evaluation order of std:move(), to avoid future issues. This will be done by splitting the use of variables values prior to performing std:move Bug: webrtc:15771 Change-Id: Ia88e733c3a4edf729e440295ae271d3cd9926ec5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334461 Reviewed-by: Mirko Bonadei Commit-Queue: Harald Alvestrand Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#41532} --- net/dcsctp/tx/rr_send_queue.cc | 5 +++-- p2p/base/stun_dictionary.cc | 3 ++- pc/test/svc_e2e_tests.cc | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/net/dcsctp/tx/rr_send_queue.cc b/net/dcsctp/tx/rr_send_queue.cc index 7cbead296c..3e682fdca6 100644 --- a/net/dcsctp/tx/rr_send_queue.cc +++ b/net/dcsctp/tx/rr_send_queue.cc @@ -373,8 +373,9 @@ void RRSendQueue::Add(Timestamp now, : Timestamp::PlusInfinity(), .lifecycle_id = send_options.lifecycle_id, }; - GetOrCreateStreamInfo(message.stream_id()) - .Add(std::move(message), std::move(attributes)); + StreamID stream_id = message.stream_id(); + GetOrCreateStreamInfo(stream_id).Add(std::move(message), + std::move(attributes)); RTC_DCHECK(IsConsistent()); } diff --git a/p2p/base/stun_dictionary.cc b/p2p/base/stun_dictionary.cc index 318bed0ad1..aabb8c394f 100644 --- a/p2p/base/stun_dictionary.cc +++ b/p2p/base/stun_dictionary.cc @@ -214,7 +214,8 @@ StunDictionaryView::ApplyDelta(const StunByteStringAttribute& delta) { if (attr->value_type() == STUN_VALUE_BYTE_STRING && attr->length() == 0) { attrs_.erase(attr->type()); } else { - attrs_[attr->type()] = std::move(attr); + int attribute_type = attr->type(); + attrs_[attribute_type] = std::move(attr); } } } diff --git a/pc/test/svc_e2e_tests.cc b/pc/test/svc_e2e_tests.cc index 3fde5a44e0..3501b64947 100644 --- a/pc/test/svc_e2e_tests.cc +++ b/pc/test/svc_e2e_tests.cc @@ -336,10 +336,9 @@ TEST_P(SvcTest, ScalabilityModeSupported) { RtpEncodingParameters parameters; parameters.scalability_mode = SvcTestParameters().scalability_mode; video.encoding_params.push_back(parameters); - alice->AddVideoConfig( - std::move(video), - CreateScreenShareFrameGenerator( - video, ScreenShareConfig(TimeDelta::Seconds(5)))); + auto generator = CreateScreenShareFrameGenerator( + video, ScreenShareConfig(TimeDelta::Seconds(5))); + alice->AddVideoConfig(std::move(video), std::move(generator)); alice->SetVideoCodecs({video_codec_config}); }, [](PeerConfigurer* bob) {}, std::move(analyzer));