diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-02-16 16:34:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-16 16:34:18 +0100 |
commit | cf582a6d14d54464eda5ac09d0896925f54f3b10 (patch) | |
tree | 71fe86bc7f3682656be89cbac0c571ca7a47911f /lib/private/legacy | |
parent | cdc48d301e3d4b8ad77e5e279f240ac1d441f252 (diff) | |
parent | 2585f195da76b278e0a8539c23e6b0d32000656e (diff) | |
download | nextcloud-server-cf582a6d14d54464eda5ac09d0896925f54f3b10.tar.gz nextcloud-server-cf582a6d14d54464eda5ac09d0896925f54f3b10.zip |
Merge pull request #3439 from nextcloud/oc-26963
Make sure invalid images don't flood the log file
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/image.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index 5403cccd026..47f2a977e9c 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -747,7 +747,7 @@ class OC_Image implements \OCP\IImage { $this->logger->warning($error, array('app' => 'core')); return $im; } - $color = unpack('V', $part . $vide); + $color = @unpack('V', $part . $vide); break; case 16: if (!($part = substr($data, $p, 2))) { @@ -755,20 +755,20 @@ class OC_Image implements \OCP\IImage { $this->logger->warning($error, array('app' => 'core')); return $im; } - $color = unpack('v', $part); + $color = @unpack('v', $part); $color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3); break; case 8: - $color = unpack('n', $vide . substr($data, $p, 1)); - $color[1] = $palette[$color[1] + 1]; + $color = @unpack('n', $vide . substr($data, $p, 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 = @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)); + $color = @unpack('n', $vide . substr($data, floor($p), 1)); switch (($p * 8) % 8) { case 0: $color[1] = $color[1] >> 7; @@ -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); |