diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2015-01-02 09:46:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-01-14 13:38:23 (GMT) |
commit | ea916230efeb59938b04f9286a56ea9db1a3af6c (patch) | |
tree | 67c8180402c2bbefba232c1a645f30b9bf3ff468 | |
parent | c118816d44e178e4364a0c32aaece81a14511237 (diff) | |
download | CMake-ea916230efeb59938b04f9286a56ea9db1a3af6c.zip CMake-ea916230efeb59938b04f9286a56ea9db1a3af6c.tar.gz CMake-ea916230efeb59938b04f9286a56ea9db1a3af6c.tar.bz2 |
CPack: Avoid crash on invalid CMake generator name (#15308)
Case where CPACK_CMAKE_GENERATOR value is non existent or
or contains multiple words that were not quoted was not
handled and produced a segmentation fault.
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 1461bb1..84e6482 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -628,6 +628,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmGlobalGenerator* globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( cmakeGenerator); + if ( !globalGenerator ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Specified package generator not found. " + "CPACK_CMAKE_GENERATOR value is invalid." + << std::endl); + return 0; + } // set the global flag for unix style paths on cmSystemTools as // soon as the generator is set. This allows gmake to be used // on windows. |