Bug 53446 - [PATCH] Fix some problems extracting PNGs
Summary: [PATCH] Fix some problems extracting PNGs
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.9-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-21 05:34 UTC by Luke Quinane
Modified: 2012-08-04 05:31 UTC (History)
0 users



Attachments
The patch to fix extraction problems. (6.88 KB, application/octet-stream)
2012-06-21 05:34 UTC, Luke Quinane
Details
Word document with the problem. (75.50 KB, application/msword)
2012-06-21 05:34 UTC, Luke Quinane
Details
Powerpoint document with the problem. (828.05 KB, application/octet-stream)
2012-06-21 05:37 UTC, Luke Quinane
Details
Exce; document with the problem. (210.36 KB, application/octet-stream)
2012-06-21 05:37 UTC, Luke Quinane
Details
Patch to add unit tests. (6.32 KB, application/octet-stream)
2012-07-25 05:07 UTC, Luke Quinane
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Quinane 2012-06-21 05:34:15 UTC
Created attachment 28974 [details]
The patch to fix extraction problems.

HSLF had some code to chop off 16 bytes of "Mac data" from some PNGs; I found samples of the same thing in Word and Excel so I've applied a similar fix to those formats too.

Also fixed HSLF to look for the PNG header instead of using ImageIO to load up the whole image.
Comment 1 Luke Quinane 2012-06-21 05:34:51 UTC
Created attachment 28975 [details]
Word document with the problem.
Comment 2 Luke Quinane 2012-06-21 05:37:02 UTC
Created attachment 28976 [details]
Powerpoint document with the problem.
Comment 3 Luke Quinane 2012-06-21 05:37:23 UTC
Created attachment 28977 [details]
Exce; document with the problem.
Comment 4 Yegor Kozlov 2012-06-25 07:37:33 UTC
Can you add some unit tests that assert that POI can read PNGs with "mac headers"? 
The patch looks good but I'm reluctant to apply it without tests.

Regards,
Yegor
Comment 5 Luke Quinane 2012-07-02 06:27:05 UTC
Hi Yegor,

I'm a bit tied up at the moment with other things but I'll try to add some unit tests in a week or so.


Cheers,

Luke
Comment 6 Luke Quinane 2012-07-25 05:07:47 UTC
Created attachment 29110 [details]
Patch to add unit tests.

Here is a patch to add unit tests. I had to delete the test data out of the patch because it was too big to upload to bugzilla. I just used each of the three sample files attached previously.

Cheers,

Luke
Comment 7 Yegor Kozlov 2012-08-04 05:31:15 UTC
Thanks for the patch, applied oin r1369263

Regards,
Yegor