Skip to content

Commit

Permalink
fix(previews): Stop returning true when getimagesize() fails
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
  • Loading branch information
joshtrichards committed Jul 14, 2024
1 parent ca50c31 commit 69cf936
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion 3rdparty
Submodule 3rdparty deleted from 72598d
6 changes: 3 additions & 3 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -590,7 +590,7 @@ private function checkImageSize($path) {
private function checkImageDataSize($data) {
$size = @getimagesizefromstring($data);
if (!$size) {
return true;
return false;
}

$width = $size[0];
Expand Down Expand Up @@ -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']);
Expand Down

0 comments on commit 69cf936

Please sign in to comment.