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
This commit is contained in:
parent
5801aa36b2
commit
dd21676086
@ -356,6 +356,9 @@ public class NPOIFSFileSystem extends BlockStore
|
|||||||
readBAT(fatAt, loopDetector);
|
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
|
// Now read the XFAT blocks, and the FATs within them
|
||||||
BATBlock xfat;
|
BATBlock xfat;
|
||||||
int nextAt = _header.getXBATIndex();
|
int nextAt = _header.getXBATIndex();
|
||||||
@ -367,11 +370,14 @@ public class NPOIFSFileSystem extends BlockStore
|
|||||||
nextAt = xfat.getValueAt(bigBlockSize.getXBATEntriesPerBlock());
|
nextAt = xfat.getValueAt(bigBlockSize.getXBATEntriesPerBlock());
|
||||||
_xbat_blocks.add(xfat);
|
_xbat_blocks.add(xfat);
|
||||||
|
|
||||||
for(int j=0; j<bigBlockSize.getXBATEntriesPerBlock(); j++) {
|
// Process all the (used) FATs from this XFAT
|
||||||
|
int xbatFATs = Math.min(remainingFATs, bigBlockSize.getXBATEntriesPerBlock());
|
||||||
|
for(int j=0; j<xbatFATs; j++) {
|
||||||
int fatAt = xfat.getValueAt(j);
|
int fatAt = xfat.getValueAt(j);
|
||||||
if(fatAt == POIFSConstants.UNUSED_BLOCK || fatAt == POIFSConstants.END_OF_CHAIN) break;
|
if(fatAt == POIFSConstants.UNUSED_BLOCK || fatAt == POIFSConstants.END_OF_CHAIN) break;
|
||||||
readBAT(fatAt, loopDetector);
|
readBAT(fatAt, loopDetector);
|
||||||
}
|
}
|
||||||
|
remainingFATs -= xbatFATs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're now able to load steams
|
// We're now able to load steams
|
||||||
|
Loading…
Reference in New Issue
Block a user