Bug 41032 - HWPF returns the wrong content bytes for compressed pictures
Summary: HWPF returns the wrong content bytes for compressed pictures
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: unspecified
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2006-11-23 20:20 UTC by Trejkaz (pen name)
Modified: 2006-11-29 06:50 UTC (History)
0 users

Patch to support compressed images and detect EMF, WMF image types (13.06 KB, patch)
2006-11-23 20:48 UTC, Trejkaz (pen name)
Details | Diff
vector_image.doc (23.50 KB, application/octet-stream)
2006-11-28 18:45 UTC, Trejkaz (pen name)
vector_image.emf (7.18 KB, application/octet-stream)
2006-11-28 18:46 UTC, Trejkaz (pen name)

Note You need to log in before you can comment on or make changes to this bug.
Description Trejkaz (pen name) 2006-11-23 20:20:48 UTC
EMF, WMF and PICT files stored within Word documents are often compressed to
save space.  In this situation, Picture.getContent() returns the compressed data
with a bunch of header crud.

Interestingly, I've found EMF and WMF files stored without compression so it may
also be possible to find a BMP file with compression.

I've been working on a fix for this one already so don't anyone else go rushing
to fix it, please.  This bug is to track the fact that it's an issue in case
anyone else runs into it. :-)
Comment 1 Trejkaz (pen name) 2006-11-23 20:48:34 UTC
Created attachment 19168 [details]
Patch to support compressed images and detect EMF, WMF image types

This patch comes with a unit test and doesn't break the existing tests, so it
should be committed pretty quickly, right? :-)
Comment 2 Nick Burch 2006-11-28 08:06:48 UTC
Alas you patch doesn't contain the test images, as svn diff doesn't work like
that :/

Any chance you could zip up your new test images, and attach the zip file to the

Otherwise, the patch looks fine (though I'll have to trust you that it actually
Comment 3 Trejkaz (pen name) 2006-11-28 18:45:27 UTC
Created attachment 19189 [details]
Comment 4 Trejkaz (pen name) 2006-11-28 18:46:01 UTC
Created attachment 19190 [details]

Both files are attached now.  Guess I'm too used to some other version control
system where the diffs do include the binaries. :-)
Comment 5 Nick Burch 2006-11-29 06:50:07 UTC
Thanks for this, I've applied the patch