From: Nick Burch Date: Mon, 4 Feb 2013 12:52:12 +0000 (+0000) Subject: An XBAT may not be fully used, and remaining entries may be 0 not POIFSConstants... X-Git-Tag: 3.10-beta1~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d526d35ff769c96ff18cb3af9352076653de14aa;p=poi.git An XBAT may not be fully used, and remaining entries may be 0 not POIFSConstants.UNUSED_BLOCK, so avoid trying to process any that we know aren't used. Fixes bug #53810 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1442095 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index def2af198d..d2e399794b 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java +++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java @@ -356,6 +356,9 @@ public class NPOIFSFileSystem extends BlockStore readBAT(fatAt, loopDetector); } + // Work out how many FAT blocks remain in the XFATs + int remainingFATs = _header.getBATCount() - _header.getBATArray().length; + // Now read the XFAT blocks, and the FATs within them BATBlock xfat; int nextAt = _header.getXBATIndex(); @@ -367,11 +370,14 @@ public class NPOIFSFileSystem extends BlockStore nextAt = xfat.getValueAt(bigBlockSize.getXBATEntriesPerBlock()); _xbat_blocks.add(xfat); - for(int j=0; j