Bug 35486 - File with size different of modulos 512 or 0x200
Summary: File with size different of modulos 512 or 0x200
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 2.5-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-23 17:51 UTC by Christophe DUPUIS
Modified: 2005-06-27 06:47 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe DUPUIS 2005-06-23 17:51:25 UTC
When opening a file with POIFSFileSystem fs = new POIFSFileSystem(fis);
if this file have a size not modulus 0x200 then an exception occured.

It's seem that old Ole Document can have this size for example : 539 990 bytes
(0x83D56).

If the file is re save with new softwar, then the size is : 603 136 bytes (0x93400)

I have done a patch in RawDataBlock
        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
        int count = IOUtils.readFully(stream, _data);

        if (count == -1)
        {
            _eof = true;
        }
        else if (count != POIFSConstants.BIG_BLOCK_SIZE)
        {
            String type = " byte" + ((count == 1) ? ("")
                                                  : ("s"));
/*
            throw new IOException("Unable to read entire block; " + count
                                  + type + " read; expected "
                                  + POIFSConstants.BIG_BLOCK_SIZE + " bytes");
                                  */
                                 System.err.println("Unable to read entire
block; " + count
                                 + type + " read; expected "
                                 + POIFSConstants.BIG_BLOCK_SIZE + " bytes"
);
        }
        else
        {
            _eof = false;
        }
Comment 1 Marc Johnson 2005-06-27 14:47:17 UTC
I'm thinking this has to be a really old document that doesn't conform to the 
current model for OLE documents. Under the current model, documents have to be 
written in blocks and the block size is a power of 2. The only block size that 
would make sense for the document cited is *2 bytes*, which would be extremely 
inefficient.