php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30672 Problem handling exif data in jpeg images at unusual places
Submitted: 2004-11-03 15:15 UTC Modified: 2005-02-01 22:54 UTC
From: bosse at mellberg dot org Assigned: helly (profile)
Status: Closed Package: EXIF related
PHP Version: 4.3.9, 5.0.2 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bosse at mellberg dot org
New email:
PHP Version: OS:

 

 [2004-11-03 15:15 UTC] bosse at mellberg dot org
Description:
------------
Using the script in the documentation for exif_thumbnail, you can extract the thumbnail image from the exif-header. If you alter the exif-information (f.ex. delete the thumbnail and add it again) using Exifer, the exif_thumbnail function will no longer be able to find the thumbnail.

According to the author of Exifer, this is likely because exif_thumbnail doesn't handle offsets to the thumbnail properly.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-03 21:12 UTC] helly@php.net
I need such an image because i don't have Exifer.
 [2004-11-04 00:09 UTC] bosse at mellberg dot org
Example pictures can be found here:
http://www.mellberg.org/exif_thumbnail
 [2004-11-04 00:57 UTC] helly@php.net
Well it looks like you exchanged working/non working, however both are pretty fine using HEAD. If you want to verify yourself then doenload php source and edit ext/exif/exif.c and change the line "#undef EXIF_DEBUG" into "#define EXIF_DEBUG". Then you'll see all details of the decoding process.

The test script i used was: 
php -r 'file_put_contents($argv[1].".thumb.jpg", exif_thumbnail($argv[1]));' filename.jpg

and then i looked at the generated file and both are fine.
To Exifer i can only say it seems to correctly rewrite the info as expected.

If you find an image that really doesn't work of it is specific to older php versions then feel free to reopen.
 [2004-11-04 21:12 UTC] helly@php.net
Reopen and set the summary to the real cause.

You can already get your thumbnails when ignoring the warnign.
 [2004-11-04 21:13 UTC] helly@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

After trying something more i actually really found a problem. Newer Exif versions allow data storage at places older versions didn't allow for JPEG images. Removing that check fixed your problem. Since the check is in general not really necessary i simply allow such out of space data for JPEG, too. 

However as already mentioned you could have got your thumbnail data anyway.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC