Browse Source

skip very long lines as they probably arent the correct path and it fixes a crash when the regex match is to big

merge-requests/413/head
Jørgen Lien Sellæg 3 years ago
parent
commit
fd836b0ecf
  1. 5
      src/project_build.cpp

5
src/project_build.cpp

@ -147,6 +147,8 @@ boost::filesystem::path Project::CMakeBuild::get_executable(const boost::filesys
return executable;
}
const auto max_path_length_linux = 4095;
bool Project::CMakeBuild::is_valid(const boost::filesystem::path &build_path) const {
if(project_path.empty() || build_path.empty())
return true;
@ -157,6 +159,9 @@ bool Project::CMakeBuild::is_valid(const boost::filesystem::path &build_path) co
bool correct_source_dir = false;
bool correct_cmake_command = false;
while(std::getline(input, line)) {
if(line.size() >= max_path_length_linux) {
continue;
}
const static std::regex source_dir_regex("^.*_SOURCE_DIR:STATIC=(.*)\r?$", std::regex::optimize);
const static std::regex cmake_command_regex("^CMAKE_COMMAND:INTERNAL=(.*)\r?$", std::regex::optimize);
std::smatch sm;

Loading…
Cancel
Save