poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51461] New: Infinite loop in IOUtils.readFully() when channel.read() returns 0 on specific files
Date Fri, 01 Jul 2011 12:00:23 GMT

             Bug #: 51461
           Summary: Infinite loop in IOUtils.readFully() when
                    channel.read() returns 0 on specific files
           Product: POI
           Version: 3.8-dev
          Platform: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POIFS
        AssignedTo: dev@poi.apache.org
        ReportedBy: gabriele@apache.org
    Classification: Unclassified

Created attachment 27238
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27238
Examples of 66048 bytes XLS which generates and infinite loop

In IOUtils.readFully() with certain specific file types / size (tested with
Microsoft Excel) I had an infinite loop when basically channel.read()
infinitely returns 0 (instead of -1 or the number of bytes read).

As per JDK 1.6 NIO documentation
it's "possible" that ReadableByteChannel.read returns 0, quoting:

int read()

    The number of bytes read, possibly zero, or -1 if the channel has reached

Now basically I got an infinite loop on all files which are funnily enough of
the same file size (66048 bytes = 65536 content + 512 header), so I'm wondering
whether this is related to that or to the specific file.

I'm attaching the XLS which generates the infinite loop (broken.xls) and a
working one (working.xls).

I also created a test case mimicking the way I was reading the file (using Tika
OfficeParser) which shows the issue (and the working case). In order to run the
JUnit you'll need the two test files on the same folder you run it from.

I fine wrote a tentative patch (1 character), which passes the test case and
temporarily solved the problem in the production instance I was working on, but
I'm not fully sure it's the correct way to do it.

I had this on Win 2008 Server (virtualized with VMWare) and my local MacOSX

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message