Bug #72278 [Opn->Ana]: getimagesize returning FALSE on valid jpg

From: Date: Sun, 05 Jun 2016 04:47:37 +0000
Subject: Bug #72278 [Opn->Ana]: getimagesize returning FALSE on valid jpg
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201454@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72278&edit=1 ID: 72278 Updated by: requinix@php.net Reported by: bfarber at invisiopower dot com Summary: getimagesize returning FALSE on valid jpg -Status: Open +Status: Analyzed Type: Bug Package: GetImageSize related Operating System: AWS / Windows PHP Version: 5.6.22 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2016-06-05 04:47:28] requinix@php.net @bfarber uploaded one to http://bfarber.com/getimagesize_test/image.jpg, which is still accessible. (I've tried a couple free hosting places but they reprocess images.) ------------------------------------------------------------------------ [2016-06-05 04:22:26] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2016-05-28 04:01:19] pajoye@php.net Can you upload the image somewhere pls or send it to me pls? ------------------------------------------------------------------------ [2016-05-27 22:28:41] requinix@php.net The image has some extra bytes in it that are messing up the detection, but there's not much technical information about JPEGs out there and the standard itself is paywalled so I can't verify if it's technically legal or just a vendor quirk. If I open the image in GIMP it warns me about the extra bytes and recovers. Those extra bytes are part of the 0xE1 Exif frame starting at offset 0x15. It says length 0x7D08/32008 but there are then 260 bytes of 0x00 unaccounted for until the next 0xFFED. Image suggests it's from Photoshop CS2? Could image.c's php_next_marker gracefully handle this situation? Automatically consume any "leading" nulls it finds? ------------------------------------------------------------------------ [2016-05-27 20:45:31] bfarber at invisiopower dot com Description: ------------ The documentation for getimagesize() indicates the function returns FALSE on failure, so the function is behaving as described, however I cannot find any reason getimagesize() should be failing to parse this particular image. A client has supplied a valid jpeg image and I can read the EXIF data from it with a standalone parser, but getimagesize() fails to parse it. We have tested on multiple versions and have seen the same behavior on all environments we've tested on. I have not tested PHP7 yet. I have tested on Amazon's hosting environment, as well as my local WAMP stack. http://bfarber.com/getimagesize_test/test.php Image can be found here: http://bfarber.com/getimagesize_test/image.jpg Test script: --------------- <?php ini_set('display_errors',1); error_reporting(E_ALL); print "PHP version is " . PHP_VERSION . "<br>"; var_dump( getimagesize('image.jpg') ); exit; Expected result: ---------------- I should see an array output with the image width, height, etc. Actual result: -------------- boolean false is returned ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72278&edit=1

« previous php.bugs (#201454) next »