Out of range access of vector when configure fails from within Visual Studio
When configure fails with errors in the ZERO_CHECK
target inside Visual Studio CMake accesses the LocalGenerators
vector out of range when trying to call the MacroStop
macro in CallVisualStudioMacro
. The vector LocalGenerators
is empty in the line:
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
Callstack:
cmake.exe!cmGlobalVisualStudioGenerator::CallVisualStudioMacro(cmGlobalVisualStudioGenerator::MacroName m, const char * vsSolutionFile) Line 294 C++
cmake.exe!cmake::Run(const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > & args, bool noconfigure) Line 1753 C++
cmake.exe!`anonymous namespace'::do_cmake(int ac, const char * const * av) Line 276 C++
cmake.exe!main(int ac, const char * const * av) Line 701 C++
Arguments:
"D:\\Projects\\cmake\\bin\\Debug\\cmake.exe"
"-SC:/cygwin64/home/daniel.eiband/test/playground"
"-BC:/cygwin64/home/daniel.eiband/test/build"
"--check-stamp-list"
"CMakeFiles/generate.stamp.list"
"--vs-solution-file"
"C:/cygwin64/home/daniel.eiband/test/build/Test.sln"
This seems to be unnoticed in release builds so far, because the value of mf
is only used if vsSolutionFile
is not given. However accessing the first element of an empty vector is undefined behavior after all.
Edited by Daniel Eiband