diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index bade2a1af3709..1e4afeef33884 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -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: