From 463357535605c1782df9225d193e3b18aa43b8c0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 3 Apr 2014 17:54:31 +0200 Subject: [PATCH] Restricted isImage for files which are natively displayable by browsers This prevents other files (e.g. PSD, image/psd) from being passed to GD which cannot handle them at all. --- .../files/lib/data/attachment/AttachmentAction.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 792ec8f872..fac396da48 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -145,10 +145,13 @@ class AttachmentAction extends AbstractDatabaseObjectAction { // get image data if (($imageData = $file->getImageData()) !== null) { - $data['isImage'] = 1; $data['width'] = $imageData['width']; $data['height'] = $imageData['height']; $data['fileType'] = $imageData['mimeType']; + + if (preg_match('~^image/(gif|jpe?g|png)$~i', $data['fileType'])) { + $data['isImage'] = 1; + } } // create attachment -- 2.20.1