diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-01-08 11:16:43 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-01-08 11:16:43 +0300 |
commit | 953be4bbe1a15e324714dcc3289c177425af618b (patch) | |
tree | 485a5c5d1733516a9c7f1f3952d0b7f9c77c16b9 | |
parent | 751abb611944fbd6b73a01e60df09bba853fdf02 (diff) |
Fix so PHP warnings are ignored when resizing a malformed image attachment (#8387)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_image.php | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ad5a27294..4bc3cca6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ - Fix compatibility with Referrer-Policy: "strict-origin" (#8170) - Fix locked SQLite database for the CLI tools (#8035) - Fix Makefile on Linux (#8211) +- Fix so PHP warnings are ignored when resizing a malformed image attachment (#8387) ## Release 1.5.2 diff --git a/program/lib/Roundcube/rcube_image.php b/program/lib/Roundcube/rcube_image.php index 42d87e67d..1b980c8b9 100644 --- a/program/lib/Roundcube/rcube_image.php +++ b/program/lib/Roundcube/rcube_image.php @@ -216,17 +216,17 @@ class rcube_image } // use GD extension - if ($props['gd_type']) { + if ($props['gd_type'] && $props['width'] > 0 && $props['height'] > 0) { if ($props['gd_type'] == IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) { - $image = imagecreatefromjpeg($this->image_file); + $image = @imagecreatefromjpeg($this->image_file); $type = 'jpg'; } else if ($props['gd_type'] == IMAGETYPE_GIF && function_exists('imagecreatefromgif')) { - $image = imagecreatefromgif($this->image_file); + $image = @imagecreatefromgif($this->image_file); $type = 'gif'; } else if ($props['gd_type'] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')) { - $image = imagecreatefrompng($this->image_file); + $image = @imagecreatefrompng($this->image_file); $type = 'png'; } else { |