From 9d4f632123a7578508057d75eb4656b74302387c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 30 Jul 2024 11:21:08 +0200 Subject: [PATCH] Fix the handling of corrupted files --- wcfsetup/install/files/lib/data/file/FileEditor.class.php | 6 +++++- .../lib/system/worker/AttachmentRebuildDataWorker.class.php | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/file/FileEditor.class.php b/wcfsetup/install/files/lib/data/file/FileEditor.class.php index 2b860602c2..05656ed22c 100644 --- a/wcfsetup/install/files/lib/data/file/FileEditor.class.php +++ b/wcfsetup/install/files/lib/data/file/FileEditor.class.php @@ -128,7 +128,11 @@ class FileEditor extends DatabaseObjectEditor $width = $height = null; if ($isImage) { - [$width, $height] = \getimagesize($pathname); + try { + [$width, $height] = \getimagesize($pathname); + } catch (\Throwable) { + return null; + } } $fileAction = new FileAction([], 'create', ['data' => [ diff --git a/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php index 78d256d056..4f52554d1e 100644 --- a/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php @@ -6,10 +6,6 @@ use wcf\data\attachment\Attachment; use wcf\data\attachment\AttachmentEditor; use wcf\data\attachment\AttachmentList; use wcf\data\file\FileEditor; -use wcf\system\database\exception\DatabaseQueryException; -use wcf\system\exception\SystemException; -use wcf\system\database\exception\DatabaseQueryExecutionException; -use wcf\system\database\exception\DatabaseTransactionException; use wcf\system\WCF; /** -- 2.20.1