|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73019 getimageszie can not recognize a special kind of jpg file
Submitted: 2016-09-05 09:45 UTC Modified: 2016-09-06 09:26 UTC
From: zws at ahtvu dot ah dot cn Assigned: cmb (profile)
Status: Duplicate Package: GetImageSize related
PHP Version: 7.0.10 OS: any
Private report: No CVE-ID: None
 [2016-09-05 09:45 UTC] zws at ahtvu dot ah dot cn
   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
   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 
<       } while (marker == 0xff);
>       } while (marker == 0xff || marker == 0);

Test script:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-05 10:50 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-09-05 10:50 UTC]
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-06 01:31 UTC] zws at ahtvu dot ah dot cn
-Status: Feedback +Status: Closed
 [2016-09-06 01:31 UTC] zws at ahtvu dot ah dot cn
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) {
  string(24) "width="120" height="160""
  string(10) "image/jpeg"
 [2016-09-06 09:26 UTC]
-Status: Closed +Status: Duplicate
 [2016-09-06 09:26 UTC]
Thanks for the quick confirmation!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Aug 04 12:01:24 2021 UTC