diff options
author | Byron Marohn <combustible@live.com> | 2014-09-15 16:12:07 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-12-01 16:20:17 +0100 |
commit | fa9b36b726e7b8b35e0fee36124d52ed8fd5a9dc (patch) | |
tree | 063cf6e94dc94bb605598b5cc27539321a195be0 | |
parent | 8db4dd7585aa9daebb32a3f3305f4061b17c316d (diff) | |
download | nextcloud-server-fa9b36b726e7b8b35e0fee36124d52ed8fd5a9dc.tar.gz nextcloud-server-fa9b36b726e7b8b35e0fee36124d52ed8fd5a9dc.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>
-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 ecdad084c02..01bca8267e9 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -658,6 +658,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); |