Bug 56465 - Error message: "does your POIFS have circular or duplicate block references"
Summary: Error message: "does your POIFS have circular or duplicate block references"
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-28 07:03 UTC by peter.fetzer
Modified: 2014-04-28 07:29 UTC (History)
0 users



Attachments
zip file containing 3 sample word documents (15.36 KB, application/x-zip-compressed)
2014-04-28 07:03 UTC, peter.fetzer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description peter.fetzer 2014-04-28 07:03:58 UTC
Created attachment 31565 [details]
zip file containing 3 sample word documents

We processed some client documents where this exception was raised.  I can recreate the exception if I take a 'good' Word document, and zero out the last 100 or so bytes, samples attached.  I'm guessing the problem documents had an error when writing to disk.  The zeroed bytes 

Microsoft Word opens these documents okay, and saving them in Word will fix them.

Attached are
1. original document
2. corrupted version, I've zeroed out a bunch of bytes at the end, and slightly reduced the file size (matching the original client documents)
3. fixed version, after opened and saved in Word 2013

The full exception is


java.io.IOException: block[ 0 ] already removed - does your POIFS have circular or duplicate block references? 
        at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:89) 
        at org.apache.poi.poifs.storage.SmallDocumentBlockList.remove(SmallDocumentBlockList.java:30) 
        at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:221) 
        at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:123) 
        at org.apache.poi.poifs.storage.SmallDocumentBlockList.fetchBlocks(SmallDocumentBlockList.java:30) 
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:535) 
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:164)
Comment 1 Nick Burch 2014-04-28 07:29:34 UTC
Use NPOIFSFileSystem instead - it has a lower memory footprint AND fixes some deep seated issues POIFSFileSystem had with certain files where it got confused about circular references that didn't actually exist