diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2017-01-31 23:13:40 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-02-10 16:27:51 +0100 |
commit | 2585f195da76b278e0a8539c23e6b0d32000656e (patch) | |
tree | 735f9bdd1a99d5735c3d7f13fbc13ffb9e21325a /lib/private/legacy | |
parent | 69046c6662196aef6a716da865ea27df878706db (diff) | |
download | nextcloud-server-2585f195da76b278e0a8539c23e6b0d32000656e.tar.gz nextcloud-server-2585f195da76b278e0a8539c23e6b0d32000656e.zip |
Check if color exists in palette before using it
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/image.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index 7f4295e3e93..47f2a977e9c 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -760,12 +760,12 @@ class OC_Image implements \OCP\IImage { break; case 8: $color = @unpack('n', $vide . substr($data, $p, 1)); - $color[1] = $palette[$color[1] + 1]; + $color[1] = (isset($palette[$color[1] + 1])) ? $palette[$color[1] + 1] : $palette[1]; break; case 4: $color = @unpack('n', $vide . substr($data, floor($p), 1)); $color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F; - $color[1] = $palette[$color[1] + 1]; + $color[1] = (isset($palette[$color[1] + 1])) ? $palette[$color[1] + 1] : $palette[1]; break; case 1: $color = @unpack('n', $vide . substr($data, floor($p), 1)); @@ -795,7 +795,7 @@ class OC_Image implements \OCP\IImage { $color[1] = ($color[1] & 0x1); break; } - $color[1] = $palette[$color[1] + 1]; + $color[1] = (isset($palette[$color[1] + 1])) ? $palette[$color[1] + 1] : $palette[1]; break; default: fclose($fh); |