summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorMarek Antoniak <kfazol@gmail.com>2019-07-22 07:46:48 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-23 12:33:31 (GMT)
commitbf6f5467a0efadb10a227429d1411ac4514a298e (patch)
treed041fa144c8fcff9bc27df176ea9882e70992aa4 /Source/cmCustomCommandGenerator.cxx
parent79bcf4e1655ffa38e8f4740b19ec3a14ac567eec (diff)
downloadCMake-bf6f5467a0efadb10a227429d1411ac4514a298e.zip
CMake-bf6f5467a0efadb10a227429d1411ac4514a298e.tar.gz
CMake-bf6f5467a0efadb10a227429d1411ac4514a298e.tar.bz2
Fix allocation in CROSSCOMPILING_EMULATOR evaluation
In commit fec441ec17 (Teach CROSSCOMPILING_EMULATOR to support arguments, 2019-05-30, v3.15.0-rc1~6^2) the new member `cmCustomCommandGenerator::EmulatorsWithArguments` was not initialized to the proper size. Fix this and add a test case covering the crash that could occur with multiple commands where an emulator appears only in a later command. Fixes: #19500 Co-Author: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 89aaad0..fe228ff 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -25,6 +25,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
, OldStyle(cc.GetEscapeOldStyle())
, MakeVars(cc.GetEscapeAllowMakeVars())
, GE(new cmGeneratorExpression(cc.GetBacktrace()))
+ , EmulatorsWithArguments(cc.GetCommandLines().size())
{
const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
@@ -107,7 +108,6 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
continue;
}
- this->EmulatorsWithArguments.emplace_back();
cmSystemTools::ExpandListArgument(emulator_property,
this->EmulatorsWithArguments[c]);
}