Skip to content

Commit

Permalink
Merge pull request #3442 from nextcloud/backport-oc-26963-9
Browse files Browse the repository at this point in the history
[stable9] Make sure invalid images don't flood the log file
  • Loading branch information
rullzer authored Feb 13, 2017
2 parents fd54abf + a808233 commit 936a67a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/private/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,28 +725,28 @@ private function imagecreatefrombmp($fileName) {
$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))) {
fclose($fh);
$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;
Expand All @@ -773,7 +773,7 @@ private function imagecreatefrombmp($fileName) {
$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);
Expand Down

0 comments on commit 936a67a

Please sign in to comment.