From bffca14d964091b3256868bc42bcb9417a72629b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 19 Jan 2016 03:37:29 -0500
Subject: [PATCH] Exit when imagecreatetruecolor() fails

---
 program/lib/Roundcube/rcube_image.php |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php
index b5eec5e..78f6e61 100644
--- a/program/lib/Roundcube/rcube_image.php
+++ b/program/lib/Roundcube/rcube_image.php
@@ -232,6 +232,10 @@
                 $height    = intval($props['height'] * $scale);
                 $new_image = imagecreatetruecolor($width, $height);
 
+                if ($new_image === false) {
+                    return false;
+                }
+
                 // Fix transparency of gif/png image
                 if ($props['gd_type'] != IMAGETYPE_JPEG) {
                     imagealphablending($new_image, false);

--
Gitblit v1.9.1