summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2023-07-05 10:54:09 +0200
committerGitHub <noreply@github.com>2023-07-05 10:54:09 +0200
commit54885eaeb3e58db0dff8a13ad9985907c6528e84 (patch)
tree1a4cacfa9d8a781ad6625059265d86e0d94a3ace
parent8c3ecd2573d16ebea0633cfe8cbed5380ddc3d82 (diff)
parent7479f8f525c59e725bf627c82887dad1e78968c4 (diff)
downloadnextcloud-server-54885eaeb3e58db0dff8a13ad9985907c6528e84.tar.gz
nextcloud-server-54885eaeb3e58db0dff8a13ad9985907c6528e84.zip
Merge pull request #38959 from nextcloud/fix/oc-image-bmp-no-color
[stable25] fix: BMP image without color info causes array access on `false`
-rw-r--r--lib/private/legacy/OC_Image.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index bade2a1af37..1e4afeef338 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -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: