Make sure invalid images don't flood the log file

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-02-10 13:44:16 +01:00
parent d13f1d80a3
commit 6f0e38ac72
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 5 additions and 5 deletions

View File

@ -725,7 +725,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))) {
@ -733,20 +733,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 = @unpack('n', $vide . substr($data, $p, 1));
$color[1] = $palette[$color[1] + 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];
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;