Skip to content

Commit

Permalink
Merge pull request #38959 from nextcloud/fix/oc-image-bmp-no-color
Browse files Browse the repository at this point in the history
[stable25] fix: BMP image without color info causes array access on `false`
  • Loading branch information
ChristophWurst authored Jul 5, 2023
2 parents 8c3ecd2 + 7479f8f commit 54885ea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,11 @@ private function imagecreatefrombmp($fileName) {
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:
Expand Down

0 comments on commit 54885ea

Please sign in to comment.