diff options
author | Byron Marohn <combustible@live.com> | 2014-09-15 16:12:07 -0700 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-01-02 08:48:59 +0100 |
commit | 8778af681cb3a17068a47d9afb916f8155b66a55 (patch) | |
tree | 3725e131b8a5bfa182aa325ee566b6b3f3089c7b /lib/private/image.php | |
parent | fb63e75743cae8de15372df88f1f04bf73404981 (diff) | |
download | nextcloud-server-8778af681cb3a17068a47d9afb916f8155b66a55.tar.gz nextcloud-server-8778af681cb3a17068a47d9afb916f8155b66a55.zip |
Added error check to lib/private/image.php
This checks that imagecreatetruecolor actually creates an image, rather than returning FALSE.
Without this check, subsequent loop might create billions of ERROR-level log messages.
Signed-off-by: Byron Marohn <combustible@live.com>
Diffstat (limited to 'lib/private/image.php')
-rw-r--r-- | lib/private/image.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/image.php b/lib/private/image.php index c055c693f62..967c632ac26 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -652,6 +652,12 @@ class OC_Image { } // create gd image $im = imagecreatetruecolor($meta['width'], $meta['height']); + if ($im == FALSE) { + fclose($fh); + trigger_error('imagecreatefrombmp(): imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], E_USER_WARNING); + return FALSE; + } + $data = fread($fh, $meta['imagesize']); $p = 0; $vide = chr(0); |