1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-30 18:24:29 +01:00

SECURITY: imagemagick/graphicsmagick was ignoring all errors

So, in a much older patch I had a problem where an incorrect RGB
profile would make image uploads fail. I fixed this by using strpos
against the error message...but didn't check the return value
correctly.

That means that any error from gm/im was ignored. This caused people
to upload too large images and flood /b/ with 1 x 10000 pixel images

My fault, patched now. Sorry about that.

Conflicts:
	inc/image.php
This commit is contained in:
8chan 2014-10-11 15:41:16 -07:00 committed by czaks
parent b2cbb70da3
commit 6052ed8d3d

View File

@ -330,6 +330,7 @@ class ImageConvert extends ImageBase {
$convert_args = str_replace('-auto-orient', '', $config['convert_args']); $convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else else
$convert_args = &$config['convert_args']; $convert_args = &$config['convert_args'];
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
sprintf($convert_args, sprintf($convert_args,
$this->width, $this->width,
@ -361,10 +362,15 @@ class ImageConvert extends ImageBase {
$this->width, $this->width,
$this->height, $this->height,
escapeshellarg($this->temp)))) || !file_exists($this->temp)) { escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
if (!file_exists($this->temp)) {
$this->destroy(); if (strpos($error, "known incorrect sRGB profile") === false) {
error(_('Failed to resize image!'), null, $error); $this->destroy();
} error('Failed to resize image!', null, array('convert_error' => $error));
}
if (!file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
} }
if ($size = $this->get_size($this->temp)) { if ($size = $this->get_size($this->temp)) {
$this->width = $size[0]; $this->width = $size[0];