From 05360d19e9a32cd023166b3e08d511cbc577f8c2 Mon Sep 17 00:00:00 2001 From: Eduard Voronkin Date: Mon, 29 Sep 2025 14:48:46 -0700 Subject: [PATCH] FASTBuild: fix use-after-move Since order of parameters' evaluation is unspecified in C++, it might happen that we move `val` before we call `substt()`. --- Source/cmGlobalFastbuildGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index e113031f8e..b652d598ad 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -273,10 +273,10 @@ void cmGlobalFastbuildGenerator::ProcessEnvironment() LocalEnvironment.emplace_back(std::move(val)); } }; - for (auto& val : cmList{ EnvOverrides }) { + for (auto const& val : cmList{ EnvOverrides }) { auto const pos = val.find('='); if (pos != std::string::npos && ((pos + 1) < val.size())) { - overrideEnvVar(val.substr(0, pos + 1), std::move(val)); + overrideEnvVar(val.substr(0, pos + 1), val); } } }