summaryrefslogtreecommitdiffstats
path: root/lib/private/image.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-08-13 15:19:58 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-08-13 15:19:58 +0200
commitf61658945f5fd605a95c52d21e8f23c579fc96c6 (patch)
tree9efc77182ea773546fa106a7de47413fc3aae7b4 /lib/private/image.php
parent9ab0ebbedc2660b1ed4fd5b84927295a6a2cc2fd (diff)
downloadnextcloud-server-f61658945f5fd605a95c52d21e8f23c579fc96c6.tar.gz
nextcloud-server-f61658945f5fd605a95c52d21e8f23c579fc96c6.zip
Close file handle if exception occurs in image class
ref #10392
Diffstat (limited to 'lib/private/image.php')
-rw-r--r--lib/private/image.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/image.php b/lib/private/image.php
index 0dff8c5a9da..7ddc8dca143 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -603,6 +603,7 @@ class OC_Image {
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14));
// check for bitmap
if ($meta['type'] != 19778) {
+ fclose($fh);
trigger_error('imagecreatefrombmp: ' . $fileName . ' is not a bitmap!', E_USER_WARNING);
return false;
}
@@ -626,6 +627,7 @@ class OC_Image {
if ($meta['imagesize'] < 1) {
$meta['imagesize'] = @filesize($fileName) - $meta['offset'];
if ($meta['imagesize'] < 1) {
+ fclose($fh);
trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $fileName . '!', E_USER_WARNING);
return false;
}
@@ -666,6 +668,7 @@ class OC_Image {
break;
case 16:
if (!($part = substr($data, $p, 2))) {
+ fclose($fh);
trigger_error($error, E_USER_WARNING);
return $im;
}
@@ -712,6 +715,7 @@ class OC_Image {
$color[1] = $palette[ $color[1] + 1 ];
break;
default:
+ fclose($fh);
trigger_error('imagecreatefrombmp: '
. $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!',
E_USER_WARNING);