From 26d4c1ac3abd8638537d16506c7ec24101c59811 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 15 Mar 2010 16:53:12 +0000 Subject: save segfault causing input --- it.class | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 7a15e08..fa3eb29 100644 --- a/it.class +++ b/it.class @@ -512,8 +512,6 @@ static function _exec_quotevalue($value) */ static function imageconvert($p) { - $result = false; - if (!(($imagetype = @exif_imagetype($p['in'])) && ($type = image_type_to_extension($imagetype, false)))) { if (@get_class(it_xml::create(fopen($p['in'], "r"), array('prefix' => "_imageconvert_", 'safety' => 0))) == "_imageconvert_svg") @@ -527,9 +525,13 @@ static function imageconvert($p) $p['-opts'] = array('-thumbnail' => $p['size']) + (array)$p['-opts']; if (in_array($type, explode(',', $p['types']))) # Valid type? - $result = it::exec("convert 2>&1 -flatten -quality 75 {-opts} {in} {type}:{out}", $p) === ""; + { + $cmdoutput = it::exec('convert 2>&1 -flatten -quality 75 {-opts} {in} {type}:{out} || echo "SHELL ERROR $?"', $p); + if (it::match('SHELL ERROR 139', $cmdoutput)) # segmentation fault + copy($p['in'], "/tmp/imageconvert.segfault.in"); + } - return $result; + return $cmdoutput === ""; } -- cgit v1.2.3