diff options
author | Byron Marohn <combustible@live.com> | 2014-09-16 03:12:07 +0400 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-01-02 20:04:58 +0300 |
commit | 441cdccc3ecab5255875d35d573d430400cb312d (patch) | |
tree | d251e93a3878fe79ab98ef1fcf41f60afeffa921 /lib | |
parent | c59b22ab5538bee19070138ef1bcfbe06c58b3f9 (diff) |
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')
-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 4b4dc73e4f7..e042f27881c 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -653,6 +653,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); |