Bug #73116 [Ver->Csd]: imagecreatefromjpeg fatal error on empty file

From: Date: Sun, 10 Sep 2017 21:15:59 +0000
Subject: Bug #73116 [Ver->Csd]: imagecreatefromjpeg fatal error on empty file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211042@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73116&edit=1 ID: 73116 Updated by: cmb@php.net Reported by: chupaka at gmail dot com Summary: imagecreatefromjpeg fatal error on empty file -Status: Verified +Status: Closed Type: Bug Package: GD related Operating System: Fedora 24 PHP Version: 5.6.26 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: <https://github.com/libgd/libgd/issues/338> has recently been fixed, so I'm closing this ticket. Previous Comments: ------------------------------------------------------------------------ [2016-11-16 15:05:12] cmb@php.net It occurs to me that patch [1] wouldn't solve the issue, but rather libgd would have to fixed, see <https://github.com/libgd/libgd/issues/338>. ------------------------------------------------------------------------ [2016-11-16 14:24:14] mail at adrian-kirchner dot com Are there chances, that your patch [1] gets merged into the 5.6-branch so it finds its way into distributions like Debian? On Debian the problem still exists because it has only the patch [2] which does not work with shared libgd [3]. ``` # php -v PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies # touch test.jpg # php -r "imagecreatefromjpeg('test.jpg');" PHP Fatal error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: Empty input file in Command line code on line 1 ``` [1] <http://git.php.net/?p=php-src.git;a=commit;h=432e16cb> [2] <http://git.php.net/?p=php-src.git;a=commitdiff;h=6cb75fb1e8208d79f58351340923059d0d077ee6;hp=8b905e337c0e88ec66a25e4b7dbbd5c87279ea75> [3] <http://sources.debian.net/src/php5/5.6.27%2Bdfsg-0%2Bdeb8u1/ext/gd/gd.c/#L72> ------------------------------------------------------------------------ [2016-11-14 15:43:51] cmb@php.net Related To: Bug #73514 ------------------------------------------------------------------------ [2016-10-18 15:18:58] cmb@php.net > Seems the usual dichotomy between bundled and standalone gd > library in: > […] There shouldn't be a problem, as gd_error() is supposed to forward to php_gd_error() anyway[1]. I've nonetheless improved that recently[2]. Anyhow, with regard to the actual issue I'm at a loss. It seems that libjpeg-turbo always raises a fatal error if it detects empty input files[3]. I can't reproduce this, however, with "plain" libjpeg-turbo builds. [1] <https://github.com/php/php-src/blob/PHP-7.0.12/ext/gd/gd.c#L1054-L1056> [2] <http://git.php.net/?p=php-src.git;a=commit;h=432e16cb> [3] <https://github.com/libjpeg-turbo/libjpeg-turbo/search?utf8=%E2%9C%93&q=JERR_INPUT_EMPTY> ------------------------------------------------------------------------ [2016-10-05 14:52:29] cmb@php.net > PHP Unknown error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: > Empty input file in Exactly that issue (namely that the severity of GD errors has not been mapped correctly to PHP errors) has been fixed as of PHP 5.6.25. Maybe this issue is related to the libjpeg version/variant. I'll have another look at it. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73116 -- Edit this bug report at https://bugs.php.net/bug.php?id=73116&edit=1

« previous php.bugs (#211042) next »