From 69cf9361640796eb3317d0f8749655b69f6cf6a8 Mon Sep 17 00:00:00 2001 From: Josh Richards Date: Sat, 6 Jul 2024 18:01:25 -0400 Subject: [PATCH] fix(previews): Stop returning true when getimagesize() fails Signed-off-by: Josh Richards --- 3rdparty | 1 - lib/private/legacy/OC_Image.php | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 160000 3rdparty diff --git a/3rdparty b/3rdparty deleted file mode 160000 index 72598ddd873af..0000000000000 --- a/3rdparty +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 72598ddd873afd5643d62ddfc4d962d04b2b4519 diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index cc6968839d44f..622c1704b098b 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -569,7 +569,7 @@ private function checkImageMemory($width, $height) { private function checkImageSize($path) { $size = @getimagesize($path); if (!$size) { - return true; + return false; } $width = $size[0]; @@ -590,7 +590,7 @@ private function checkImageSize($path) { private function checkImageDataSize($data) { $size = @getimagesizefromstring($data); if (!$size) { - return true; + return false; } $width = $size[0]; @@ -637,7 +637,7 @@ public function loadFromFile($imagePath = false) { if (!$this->checkImageSize($imagePath)) { return false; } - if (getimagesize($imagePath) !== false) { + if (@getimagesize($imagePath) !== false) { $this->resource = @imagecreatefromjpeg($imagePath); } else { $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']);