Bug 53446

Summary: [PATCH] Fix some problems extracting PNGs
Product: POI Reporter: Luke Quinane <luke>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.9-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: The patch to fix extraction problems.
Word document with the problem.
Powerpoint document with the problem.
Exce; document with the problem.
Patch to add unit tests.

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