Bug #73019 [Fbk->Csd]: getimageszie can not recognize a special kind of jpg file
| From: | zws at ahtvu dot ah dot cn | Date: | Tue, 06 Sep 2016 01:31:13 +0000 |
| Subject: | Bug #73019 [Fbk->Csd]: getimageszie can not recognize a special kind of jpg file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203820@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73019&edit=1
ID: 73019
User updated by: zws at ahtvu dot ah dot cn
Reported by: zws at ahtvu dot ah dot cn
Summary: getimageszie can not recognize a special kind of jpg
file
-Status: Feedback
+Status: Closed
Type: Bug
Package: GetImageSize related
Operating System: any
PHP Version: 7.0.10
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Hello,I chekout last version of php,and test the relate code,the result is ok,thanks.
[root@node5 bin]# ./php -v
PHP 7.2.0-dev (cli) (built: Sep 6 2016 09:18:22) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
[root@node5 bin]# ./php ~/zws.php
Warning: getimagesize(): corrupt JPEG data: 888 extraneous bytes before marker in /root/zws.php on
line 3
array(7) {
[0]=>
int(120)
[1]=>
int(160)
[2]=>
int(2)
[3]=>
string(24) "width="120" height="160""
["bits"]=>
int(8)
["channels"]=>
int(3)
["mime"]=>
string(10) "image/jpeg"
}
Previous Comments:
------------------------------------------------------------------------
[2016-09-05 10:50:46] cmb@php.net
That appears to be a duplicate of bug #72278, which has been
fixed, but the fix has not yet been released.
Can you please confirm with a current Git snapshot of PHP?
------------------------------------------------------------------------
[2016-09-05 09:45:07] zws at ahtvu dot ah dot cn
Description:
------------
I found a problem when php recongize a jpg file.This file can be rendered by
acdsee,ie,firefox,etc,but getimagesize function returns false.
Your can download the file from url http://bm.ahtvu.ah.cn/img/20163/a/6/5177/org_faceimg.jpg.
This file have a lot of zeros between jpg data sections,I check php source code and find that
php_next_marker function can not cope with it.
I give the following patch which I can not ensure ok under any circumstances.
[root@cache84 standard]# diff image.c patch_image.c
416c416
< } while (marker == 0xff);
---
> } while (marker == 0xff || marker == 0);
Test script:
---------------
<?php
var_dump(getimagesize('/root/f.jpg'));
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73019&edit=1