From: Alexander Ebert Date: Thu, 3 Apr 2014 15:54:31 +0000 (+0200) Subject: Restricted isImage for files which are natively displayable by browsers X-Git-Tag: 2.0.5~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=463357535605c1782df9225d193e3b18aa43b8c0;p=GitHub%2FWoltLab%2FWCF.git 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. --- 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