rjohnsondev / java-libpst

A library to read PST files with java, without need for external libraries.
249 stars 122 forks source link

Unable to decompress sub folders #59

Open toherrmann opened 7 years ago

toherrmann commented 7 years ago

Running example.Test with an Outlook 2016.ost produces following error:

Can't get children for folder Posteingang(8578) child count: 7 - com.pff.PSTException: Unable to decompress reportedly compressed block, using alternate child tree with 7 items

After reactivation of try/ catch in PSTNodeInputStream.java:136 it says:

java.util.zip.ZipException: incorrect header check

3a00 e435 2000 0000 0000 443f 2000 0100 ..ä5......D..... 0000 2441 2000 0200 0000 84bd 2000 0300 ...A............ 0000 a4fb 2000 0400 0000 c4fb 2000 0500 ...û......Äû.... 0000 e4fb 2000 0600 0000 5800 5700 0200 ..äû......X.W... 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 0200 ................ 0200 0200 0200 0200 0200 0200 0200 3a00 ................`

Also changing inflater code for this special case to final InflaterOutputStream inflaterStream = new InflaterOutputStream(outputStream, new Inflater(nowrap)); and giving it a "dummy" byte (described in Inflater JavaDoc) was'nt successful.

rjohnsondev commented 7 years ago

interesting, is this an OST you can provide?

toherrmann commented 7 years ago

No, I can't provide the file. It's the email account of a friend. And the file has a size of 230 MB. sry

toherrmann commented 7 years ago

I found a spec from MS. They write about "RTF compression" there. Could it be, that such a compression algorithm is used for the problematic node? MS-PST-File-Specification.pdf

rjohnsondev commented 7 years ago

nah, MS started compressing some of the file blocks with zlib in the 2013 file format, the error is indicating the library is attempting to decompress non-compressed data. This may be because the data was incorrectly assumed to be compressed, or that the wrong data was accessed. The block that you included looks like it may be a series of pointers to a composite block that may be compressed and have the actual data in it. Unfortunately the zlib compression piece is not documented so the only real way to work out (AFIK so far) is to find example PST files that demonstrate the behaviour and reverse engineer.

As an aside, the folder child records seem to be pretty fragile, and it might be worth trying SCANPST against the file to see if that makes a difference (obviously make a copy first), just in case it's a corruption issue.

toherrmann commented 7 years ago

I already tried to repair the file by SCANPST. The file size increased from 250322944 to 267001856. After that in second run SCANPST meant, that there are unimportant inconsistenies in the file, which don't need to be repaired.

toherrmann commented 7 years ago

I asked my friend to give you access to the .ost file. He agreed but only to share with you (no other people). How can we do this?

rjohnsondev commented 7 years ago

You could upload it to something like dropbox and email me a link: libpst AT rjohnson.id.au

toherrmann commented 7 years ago

You should have received the share link. This is the original (corrupted) version of that OST file.