summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-03-10 18:17:51 +0100
committerGitHub <noreply@github.com>2017-03-10 18:17:51 +0100
commit42ee4013768db719e2209978e3b7d30fd88188f9 (patch)
treecedf488069cbe16624887d68e2f1262b58a85d94 /lib/private/legacy
parentf74911b6385991a69864dbae78091f2cb502d39e (diff)
parent7dd760d737b9742e5e600a8dbf48293f567d7f72 (diff)
downloadnextcloud-server-42ee4013768db719e2209978e3b7d30fd88188f9.tar.gz
nextcloud-server-42ee4013768db719e2209978e3b7d30fd88188f9.zip
Merge pull request #3778 from nextcloud/verify_jpg_files
Test if a file is a valid jpg file
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/image.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php
index ed7dfce29a6..e26148bdf15 100644
--- a/lib/private/legacy/image.php
+++ b/lib/private/legacy/image.php
@@ -562,7 +562,11 @@ class OC_Image implements \OCP\IImage {
break;
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG) {
- $this->resource = imagecreatefromjpeg($imagePath);
+ if (getimagesize($imagePath) !== false) {
+ $this->resource = imagecreatefromjpeg($imagePath);
+ } else {
+ $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, array('app' => 'core'));
+ }
} else {
$this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, array('app' => 'core'));
}