Merge pull request #38959 from nextcloud/fix/oc-image-bmp-no-color

[stable25] fix: BMP image without color info causes array access on `false`
This commit is contained in:
Christoph Wurst 2023-07-05 10:54:09 +02:00 committed by GitHub
commit 54885eaeb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -931,6 +931,11 @@ class OC_Image implements \OCP\IImage {
break;
case 8:
$color = @unpack('n', $vide . ($data[$p] ?? ''));
if ($color === false) {
fclose($fh);
$this->logger->warning('Invalid 8bit bmp without color', ['app' => 'core']);
return false;
}
$color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1];
break;
case 4: