Skip to content

Commit 71c1e63

Browse files
committed
fix(previews): Stop returning true when getimagesize() fails
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
1 parent ca50c31 commit 71c1e63

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

3rdparty

lib/private/legacy/OC_Image.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ private function checkImageMemory($width, $height) {
569569
private function checkImageSize($path) {
570570
$size = @getimagesize($path);
571571
if (!$size) {
572-
return true;
572+
return false;
573573
}
574574

575575
$width = $size[0];
@@ -590,7 +590,7 @@ private function checkImageSize($path) {
590590
private function checkImageDataSize($data) {
591591
$size = @getimagesizefromstring($data);
592592
if (!$size) {
593-
return true;
593+
return false;
594594
}
595595

596596
$width = $size[0];
@@ -637,7 +637,7 @@ public function loadFromFile($imagePath = false) {
637637
if (!$this->checkImageSize($imagePath)) {
638638
return false;
639639
}
640-
if (getimagesize($imagePath) !== false) {
640+
if (@getimagesize($imagePath) !== false) {
641641
$this->resource = @imagecreatefromjpeg($imagePath);
642642
} else {
643643
$this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']);

0 commit comments

Comments
 (0)