ID: 25905 Updated by: [EMAIL PROTECTED] Reported By: sitnikov at infonet dot ee Status: Bogus Bug Type: GetImageSize related Operating System: Linux PHP Version: 4CVS-2003-10-18 (stable) Assigned To: helly New Comment:
Well it's a valid point you can take. Probably i'll even adapt the code for getImageSize() but not now. Previous Comments: ------------------------------------------------------------------------ [2003-10-19 05:21:36] sitnikov at infonet dot ee ok, why you implement this ? /* get marker byte, swallowing possible padding */ if ( last_marker==M_COM && comment_correction) { /* some software does not count the length bytes of COM section */ /* one company doing so is very much envolved in JPEG... so we accept too */ /* by the way: some of those companies changed their code now... */ comment_correction = 2; } else { last_marker = 0; comment_correction = 0; } ------------------------------------------------------------------------ [2003-10-19 04:56:21] [EMAIL PROTECTED] 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. Thank you for your interest in PHP. Your image file is corrupt and i don\'t think i will implement a special handling for all wrong software out there. That would lead to unrobust php code. ------------------------------------------------------------------------ [2003-10-19 03:10:52] sitnikov at infonet dot ee /usr/local/ImageMagick/bin/identify -format "%[EXIF:*]" wrong_jpeg.jpg Make=Konica Model=Revio C2 Orientation=1 XResolution=288/3 YResolution=288/3 ResolutionUnit=2 DateTime=2003:10:15 13:48:10 YCbCrPositioning=2 ExifOffset=174 ExposureTime=5924356/268435456 FNumber=28/10 ExposureProgram=3 ISOSpeedRatings=64 ExifVersion=0220 DateTimeOriginal=2003:10:15 13:48:10 DateTimeDigitized=2003:10:15 13:48:10 ComponentsConfiguration=... CompressedBitsPerPixel=1989456/1228800 ShutterSpeedValue=44/8 ApertureValue=28/10 ExposureBiasValue=0/10 MaxApertureValue=28/10 SubjectDistance=11/10 MeteringMode=5 LightSource=0 Flash=0 FocalLength=45/10 MakerNote=0060162454 FlashPixVersion=0100 ColorSpace=1 ExifImageWidth=1280 ExifImageLength=960 unknown= InteroperabilityOffset=724 unknown=R98 unknown=0100 ExposureIndex=1/1 SensingMethod=2 FileSource=. SceneType=. unknown=1280/1280 unknown=37 jpeg lib also working properly with this image. Please see this code (from jpeg-6b): next_marker (j_decompress_ptr cinfo) { int c; INPUT_VARS(cinfo); for (;;) { INPUT_BYTE(cinfo, c, return FALSE); /* Skip any non-FF bytes. * This may look a bit inefficient, but it will not occur in a valid file. * We sync after each discarded byte so that a suspending data source * can discard the byte from its buffer. */ while (c != 0xFF) { cinfo->marker->discarded_bytes++; INPUT_SYNC(cinfo); INPUT_BYTE(cinfo, c, return FALSE); } /* This loop swallows any duplicate FF bytes. Extra FFs are legal as * pad bytes, so don't count them in discarded_bytes. We assume there * will not be so many consecutive FF bytes as to overflow a suspending * data source's input buffer. */ do { INPUT_BYTE(cinfo, c, return FALSE); } while (c == 0xFF); if (c != 0) break; /* found a valid marker, exit loop */ /* Reach here if we found a stuffed-zero data sequence (FF/00). * Discard it and loop back to try again. */ cinfo->marker->discarded_bytes += 2; INPUT_SYNC(cinfo); } if (cinfo->marker->discarded_bytes != 0) { WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c); cinfo->marker->discarded_bytes = 0; } cinfo->unread_marker = c; INPUT_SYNC(cinfo); return TRUE; } ------------------------------------------------------------------------ [2003-10-18 20:20:22] [EMAIL PROTECTED] Interesting. Could you try to open the file with the exif functions? But however the file is borked. ------------------------------------------------------------------------ [2003-10-18 18:05:49] sitnikov at infonet dot ee Description: ------------ getimagesize fail with jpeg created by 602PC Suite software Example jpeg: http://si.infonet.ee/wrong_jpeg.jpg All other software (Photoshop, ACDSee, xnview, IE, Mozila, Opera, etc) open this file correctly. ImageMagic/identify says: /usr/local/ImageMagick/bin/identify: Corrupt JPEG data: 2 extraneous bytes before marker 0xfe After some debuging, i can see, than this jpg file have 2 zero byte before next marker, and php_next_marker fail with this data. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25905&edit=1