Skip to content

Commit

Permalink
#3254
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Jun 12, 2016
1 parent b8c3d57 commit e0437e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 12.06.2016 14:55:52 +0200 - build 4703

1. 0003254: Far 3.0 build 4700-4702 crashes on long file lists (!&)

drkns 11.06.2016 22:55:07 +0200 - build 4702

1. Ещё одно уточнение работы запускателя.
Expand Down
27 changes: 21 additions & 6 deletions far/execute.cpp
Expand Up @@ -341,14 +341,24 @@ static bool FindObject(const string& Module, string &strDest, bool &Internal)
*/
static bool PartCmdLine(const string& CmdStr, string &strNewCmdStr, string &strNewCmdPar)
{
if (Global->Opt->Exec.ComspecConditionRe.Pattern != Global->Opt->Exec.ComspecCondition.Get())
auto UseFallbackCondition = false;
try
{
Global->Opt->Exec.ComspecConditionRe.Re.assign(Global->Opt->Exec.ComspecCondition.Get(), std::regex::optimize);
Global->Opt->Exec.ComspecConditionRe.Pattern = Global->Opt->Exec.ComspecCondition;
}
if (Global->Opt->Exec.ComspecConditionRe.Pattern != Global->Opt->Exec.ComspecCondition.Get())
{
Global->Opt->Exec.ComspecConditionRe.Re.assign(Global->Opt->Exec.ComspecCondition.Get(), std::regex::optimize);
Global->Opt->Exec.ComspecConditionRe.Pattern = Global->Opt->Exec.ComspecCondition;
}

if (std::regex_search(CmdStr, Global->Opt->Exec.ComspecConditionRe.Re))
return false;
if (std::regex_search(CmdStr, Global->Opt->Exec.ComspecConditionRe.Re))
return false;
}
catch(const std::regex_error&)
{
// - regex is provided by user and it might be incorrect
// - string might be too long
UseFallbackCondition = true;
}

const auto Begin = CmdStr.cbegin() + CmdStr.find_first_not_of(L' ');
const auto End = CmdStr.cend();
Expand All @@ -363,6 +373,11 @@ static bool PartCmdLine(const string& CmdStr, string &strNewCmdStr, string &strN
InQuotes = !InQuotes;
}

if (!InQuotes && UseFallbackCondition && wcschr(L"<>|&", *i))
{
return false;
}

if (!InQuotes && *i == L' ')
{
CmdEnd = i;
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4702)m4_dnl
m4_define(BUILD,4703)m4_dnl

0 comments on commit e0437e4

Please sign in to comment.