From d148b6cc91547c2d82f0f6bcc2ca975e9d42d6ec Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@gmail.com>
Date: Fri, 13 Sep 2019 15:13:13 +0200
Subject: [PATCH] FIX #11611 TIME 0:05 added timeout to unoconv command

---
 src/app/convert/controllers/ConvertPdfController.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/app/convert/controllers/ConvertPdfController.php b/src/app/convert/controllers/ConvertPdfController.php
index 92818f6dbc1..27137ca3a7b 100755
--- a/src/app/convert/controllers/ConvertPdfController.php
+++ b/src/app/convert/controllers/ConvertPdfController.php
@@ -37,7 +37,7 @@ class ConvertPdfController
         $tmpPath = CoreConfigModel::getTmpPath();
 
         ConvertPdfController::addBom($aArgs['fullFilename']);
-        $command = "unoconv -f pdf " . escapeshellarg($aArgs['fullFilename']);
+        $command = "timeout 10 unoconv -f pdf " . escapeshellarg($aArgs['fullFilename']);
 
         exec('export HOME=' . $tmpPath . ' && '.$command.' 2>&1', $output, $return);
 
@@ -93,7 +93,7 @@ class ConvertPdfController
 
         if (strtolower($docInfo["extension"]) != 'pdf') {
             ConvertPdfController::addBom($tmpPath.$fileNameOnTmp.'.'.$docInfo["extension"]);
-            $command = "unoconv -f pdf " . escapeshellarg($tmpPath.$fileNameOnTmp.'.'.$docInfo["extension"]);
+            $command = "timeout 10 unoconv -f pdf " . escapeshellarg($tmpPath.$fileNameOnTmp.'.'.$docInfo["extension"]);
             exec('export HOME=' . $tmpPath . ' && '.$command, $output, $return);
 
             if (!file_exists($tmpPath.$fileNameOnTmp.'.pdf')) {
@@ -148,7 +148,7 @@ class ConvertPdfController
         file_put_contents($tmpPath . $tmpFilename, base64_decode($aArgs['encodedResource']));
 
         ConvertPdfController::addBom($tmpPath.$tmpFilename);
-        $command = "unoconv -f pdf {$tmpPath}{$tmpFilename}";
+        $command = "timeout 10 unoconv -f pdf {$tmpPath}{$tmpFilename}";
         exec('export HOME=' . $tmpPath . ' && '.$command, $output, $return);
 
         if (!file_exists($tmpPath.$tmpFilename.'.pdf')) {
-- 
GitLab