Fix sanity checks #16963

Signed-off-by: Samuel CHEMLA <chemla.samuel@gmail.com>
This commit is contained in:
Samuel CHEMLA 2019-09-01 22:13:25 +02:00
parent 503b9c63c3
commit 94eb77a535
1 changed files with 3 additions and 5 deletions

View File

@ -878,10 +878,8 @@ class OC_Image implements \OCP\IImage {
$widthOrig = imagesx($this->resource); $widthOrig = imagesx($this->resource);
$heightOrig = imagesy($this->resource); $heightOrig = imagesy($this->resource);
$process = imagecreatetruecolor($width, $height); $process = imagecreatetruecolor($width, $height);
if ($process === false) {
if ($process == false) {
$this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core')); $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
imagedestroy($process);
return false; return false;
} }
@ -892,8 +890,8 @@ class OC_Image implements \OCP\IImage {
imagesavealpha($process, true); imagesavealpha($process, true);
} }
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); $res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
if ($process == false) { if ($res === false) {
$this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core')); $this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core'));
imagedestroy($process); imagedestroy($process);
return false; return false;