]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added error check to lib/private/image.php
authorByron Marohn <combustible@live.com>
Mon, 15 Sep 2014 23:12:07 +0000 (16:12 -0700)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 2 Jan 2015 07:48:59 +0000 (08:48 +0100)
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>
lib/private/image.php

index c055c693f62348ab9ce94233e45fe1c062db7fce..967c632ac26653763ca59e1d09c55e7fe4e66a15 100644 (file)
@@ -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);