Samsung picture thumb not read (zero size)

Bug #72735 Samsung picture thumb not read (zero size)
Submitted: 2016-08-02 14:33 UTC Modified: 2016-08-05 05:45 UTC
From: antonin dot roussel at laposte dot net Assigned: kalle (profile)
Status: Closed Package: EXIF related
PHP Version: 5.6.24 OS: Mageia5
Private report: No CVE-ID: None

 [2016-08-02 14:33 UTC] antonin dot roussel at laposte dot net

Description:
------------
Extracting thumbnail of pictures in a gallery is ok (for instance nikon camera pictures), but for Samsung ST72/ST73 camera pictures it's broken. The data return by exif_thumbnail php function has a zero strlentgh.

To cross-check : command line exiftool sees exif preview and thumbnail data.
So there is a problem.

I can provide two sample pictures.



Patches

0001-Fix-72735-regression-in-exif-for-MakerNote.patch (last revision 2016-08-03 08:38 UTC by remi@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2016-08-02 16:07 UTC] kalle@php.net

Any chance you can leave a link to the pictures here in case a developer decides to pick it up?

 [2016-08-02 16:07 UTC] kalle@php.net

-Status: Open +Status: Feedback

 [2016-08-02 22:08 UTC] antonin dot roussel at laposte dot net

-Status: Feedback +Status: Open

 [2016-08-02 22:08 UTC] antonin dot roussel at laposte dot net

Here are some sample files, and a test script.
'sam4068.jpg',	//   broken (it's coming from a friend)
'samsung.jpg',	// * broken (minimized)
'dscn5460.jpg',	// * ok (from my camera)
'nokia.jpg',	// * ok (minimized)
// * star means : have been processed by exiftool and convert

https://www.dropbox.com/sh/ru4kwqsyt9fqd89/AACTpWWpBojkNuYGkFgsLWj2a?dl=0

 [2016-08-03 03:40 UTC] kalle@php.net

-Status: Open +Status: Closed

 [2016-08-03 03:42 UTC] kalle@php.net

-Status: Closed +Status: Feedback -Assigned To: +Assigned To: kalle

 [2016-08-03 03:42 UTC] kalle@php.net

I committed a possible fix to this on master. In my debugging it seems that there were 2 IDF tags in samsung.jpg that were returning invalid, that stopped processing (more description are available in the commit message).

Could you please test and confirm on your end? Ps. its master in git, which is PHP 7.2, thanks!

 [2016-08-03 04:10 UTC] kalle@php.net

I've reverted the fix since it seems to break other tests within ext/exif, so I will need a tiny bit more debugging to make sure it will work.

Apologies for the crushed dreams /o\

 [2016-08-03 04:10 UTC] kalle@php.net

-Status: Feedback +Status: Assigned

 [2016-08-03 04:11 UTC] kalle@php.net

-Status: Assigned +Status: Closed

 [2016-08-03 04:18 UTC] kalle@php.net

-Status: Closed +Status: Assigned

 [2016-08-03 08:03 UTC] kalle@php.net

-Status: Assigned +Status: Closed

 [2016-08-03 08:06 UTC] kalle@php.net

-Status: Closed +Status: Assigned

 [2016-08-03 08:06 UTC] kalle@php.net

@remi, can you confirm this patch also fixes the other issue from Redhat?

 [2016-08-03 08:06 UTC] kalle@php.net

-Status: Assigned +Status: Closed

 [2016-08-03 08:25 UTC] antonin dot roussel at laposte dot net

I do not have php development environment, I won't be able to test any patch.

I added two other sample pictures, from two sony camera. One is ok (sony_dslr-a700.jpg), the second (sony_dsc-rx100.jpg) shows a slightly different broken aspect.

 [2016-08-03 08:27 UTC] remi@php.net

@Kalle: your patch is fine, but only for SAMSUNG, Fedora bug is about Panasonic, please give a try to my complementary fix proposal.

 [2016-08-03 08:34 UTC] remi@php.net

Probably, should be

     length = MIN(length, strlen(value));

 [2016-08-03 12:52 UTC] antonin dot roussel at laposte dot net

sorry, there is no "slightly different aspect"

 [2016-08-03 14:40 UTC] kalle@php.net

@antonin, can you open another report and assign it to me and I will take a look at it, just reference this as it makes the whole process a little easier to deal with. Thanks (and thanks for helping PHP become even greater!)

 [2016-08-03 14:50 UTC] kalle@php.net

@Remi, one thing I was thinking about your patch, should we add a notice/warning in case we run out of possible signatures to match against, urging users to submit a bug report so we can cease out these types of reports?

 [2016-08-03 14:54 UTC] antonin dot roussel at laposte dot net

you misunderstood me, I was just inflecting my comment about added sample picture sony_dsc-rx100.jpg which indeed appears as broken as others do.
I cannot evaluate patches.
Thank you for making php handy ;-)

 [2016-08-05 05:45 UTC] kalle@php.net

I have added basic Sony support for pictures containing Sony specific EXIF data within the Exif.Sony1 namespace into the master branch

 [2016-08-22 06:06 UTC] sunkan+bugs dot gnu at zappa dot cx

Related To: Bug #72914