#34640 [Opn->Bgs]: libpng warnings and crash when reading corrupt PNG file.

From: Date: Mon, 26 Sep 2005 15:22:47 +0000
Subject: #34640 [Opn->Bgs]: libpng warnings and crash when reading corrupt PNG file.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85605@lists.php.net to get a copy of this message
ID: 34640 Updated by: iliaa@php.net Reported By: richard dot quadling at bandvulc dot co dot uk -Status: Open +Status: Bogus Bug Type: GD related Operating System: Windows 2003 & XP SP2 PHP Version: 5.0.5 New Comment: The fatal error comes from libpng, we cannot do anything about that. Previous Comments: ------------------------------------------------------------------------ [2005-09-26 16:52:17] richard dot quadling at bandvulc dot co dot uk Ilia, the bug I am reporting is NOT the libpng warnings. I don't care about them. I understand that they will break a web image and this is adequately documented. The bug is that php_gd2.dll crashes when it is trying to process a broken PNG file when the documentation says otherwise. The documentation says that the specific function will return a blank string and even provides an example of how to detect this. My example code shows that this is not the case. And the CVS produces a fatal error now. V5.0.5 crashes with no errors/warnings when processing this file. The CVS produces a Fatal error - which cannot be trapped (I believe). Richard. Either th ------------------------------------------------------------------------ [2005-09-26 16:45:37] richard dot quadling at bandvulc dot co dot uk The @ operator does NOT suppress the warnings. I even told PHP to not produce ANY output for ANY errors. No difference - still get the libpng warnings. Also, I always log any PHP errors. The only entries for bad.php are when using the CVS snapshot and are the fatal error documented previously - no libpng warnings in the PHP error log file. And the log file still shows different line endings on windows for CLI and ISAPI modes! \r\n for CLI (which is correct for Windows) \r\r\n for ISAPI (which is NOT correct for Windows) I've documented this before and suggested a fix. ------------------------------------------------------------------------ [2005-09-26 16:37:44] richard dot quadling at bandvulc dot co dot uk Ah. No. I DO get an error now though! Fatal error: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC error in C:\png2pdf\bad.php on line 11 I downloaded the PNG to C:\bad.png and edited the script to ... <?php function convertPNG_PDF($sImageLocation) { // Define an array of image resources. $aImages= array(); // Get fax dimensions. $aImageData = getimagesize($sImageLocation); // Get the image. $aImages['Original'] = imagecreatefrompng($sImageLocation); echo "We got here\n"; } $sTestPDF = convertPNG_PDF('C:/bad.png'); echo "We got to here\n"; ?> Using the C:\PHP5\PHP.EXE c:\png2pdf\bad.php produces the same ... libpng warning: Ignoring bad adaptive filter type libpng warning: Ignoring bad adaptive filter type ... repeated MANY times ... libpng warning: Ignoring bad adaptive filter type libpng warning: Ignoring bad adaptive filter type libpng warning: Extra compressed data. libpng warning: Extra compression data Fatal error: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC error in C:\png2pdf\bad.php on line 11 This particular image is broken. How do / can I upgrade libpng? Or is this part of php_gd2.dll? ------------------------------------------------------------------------ [2005-09-26 16:31:59] richard dot quadling at bandvulc dot co dot uk Ha. Someone's deleted the broken image! Argh!!!! Ha! Downloading it from the web and trying again. ------------------------------------------------------------------------ [2005-09-26 16:16:27] iliaa@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. PHP cannot do anything about warnings messages generated by the libpng library. ------------------------------------------------------------------------ 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 http://bugs.php.net/34640 -- Edit this bug report at http://bugs.php.net/?id=34640&edit=1

« previous php.bugs (#85605) next »