Impose memory usage limit on external filters. Fixes issue #259
This commit is contained in:
@@ -77,6 +77,8 @@ bool MimeHandlerExec::next_document()
|
||||
|
||||
int filtermaxseconds = 900;
|
||||
m_config->getConfParam("filtermaxseconds", &filtermaxseconds);
|
||||
int filtermaxmbytes = 0;
|
||||
m_config->getConfParam("filtermaxmbytes", &filtermaxmbytes);
|
||||
|
||||
if (params.empty()) {
|
||||
// Hu ho
|
||||
@@ -103,6 +105,7 @@ bool MimeHandlerExec::next_document()
|
||||
mexec.putenv("RECOLL_CONFDIR", m_config->getConfDir());
|
||||
mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
|
||||
"RECOLL_FILTER_FORPREVIEW=no");
|
||||
mexec.setrlimit_as(filtermaxmbytes);
|
||||
|
||||
int status;
|
||||
try {
|
||||
|
||||
@@ -47,6 +47,9 @@ bool MimeHandlerExecMultiple::startCmd()
|
||||
// Command name
|
||||
string cmd = params.front();
|
||||
|
||||
int filtermaxmbytes = 0;
|
||||
m_config->getConfParam("filtermaxmbytes", &filtermaxmbytes);
|
||||
|
||||
m_maxmemberkb = 50000;
|
||||
m_config->getConfParam("membermaxkbs", &m_maxmemberkb);
|
||||
ostringstream oss;
|
||||
@@ -57,6 +60,8 @@ bool MimeHandlerExecMultiple::startCmd()
|
||||
m_cmd.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
|
||||
"RECOLL_FILTER_FORPREVIEW=no");
|
||||
|
||||
m_cmd.setrlimit_as(filtermaxmbytes);
|
||||
|
||||
// Build parameter list: delete cmd name
|
||||
vector<string>myparams(params.begin() + 1, params.end());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user