From dd21676086a97e0789a2de71f806ebf9952a55a8 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 4 Feb 2013 12:52:12 +0000 Subject: [PATCH] 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 --- .../org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index def2af198..d2e399794 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