Bug 52035 - Large MS Word 6.0 Word Document java.lang.ArrayIndexOutOfBoundsException: -283137
Summary: Large MS Word 6.0 Word Document java.lang.ArrayIndexOutOfBoundsException: -28...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.7-FINAL
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-14 23:50 UTC by Kim Ebert
Modified: 2012-06-07 10:35 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Ebert 2011-10-14 23:50:25 UTC
Word6.0 file with 32MB size

It appears that it should be unsigned instead of signed. This patch appears to fix the problem on read. I checked and it appears to still be a problem against poi-3.8-beta4.


diff -uNr ../old/poi-3.7/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java ./src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java
--- ../old/poi-3.7/src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java 2010-10-14 04:50:23.000000000 -0600
+++ ./src/scratchpad/src/org/apache/poi/hwpf/model/OldCHPBinTable.java 2011-10-14 17:16:45.414557055 -0600
@@ -49,7 +49,7 @@
{
GenericPropertyNode node = binTable.getProperty(x);

- int pageNum = LittleEndian.getShort(node.getBytes());
+ int pageNum = LittleEndian.getUShort(node.getBytes());
int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;

CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream,
diff -uNr ../old/poi-3.7/src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java ./src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java
--- ../old/poi-3.7/src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java 2010-10-14 04:50:23.000000000 -0600
+++ ./src/scratchpad/src/org/apache/poi/hwpf/model/OldPAPBinTable.java 2011-10-14 17:18:00.047660407 -0600
@@ -40,7 +40,7 @@
{
GenericPropertyNode node = binTable.getProperty(x);

- int pageNum = LittleEndian.getShort(node.getBytes());
+ int pageNum = LittleEndian.getUShort(node.getBytes());
int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;

PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(documentStream,
Comment 1 Nick Burch 2011-10-15 12:24:13 UTC
Thanks, patch applied in r1183629.