Bug 44078 - ArrayIndexOutOfBoundsException in TableSprmUncompressor [PATCH]
Summary: ArrayIndexOutOfBoundsException in TableSprmUncompressor [PATCH]
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.0-dev
Hardware: All Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2007-12-14 02:32 UTC by Nico Verwer
Modified: 2007-12-17 06:19 UTC (History)
0 users

Word document causing the exception (56.50 KB, application/octet-stream)
2007-12-14 02:33 UTC, Nico Verwer
Patch for this bug (866 bytes, patch)
2007-12-14 02:34 UTC, Nico Verwer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Verwer 2007-12-14 02:32:25 UTC
In some rare cases, a ArrayIndexOutOfBoundsException occurs in
org.apache.poi.hwpf.sprm.TableSprmUncompressor.unCompressTAPOperation, line 152.

The problem appears to be that the grpprl does not hold data for every cell in a
row. Therefore, the computed index is larger than the length of the grpprl.

This has happened in some documents saved with Word97. When I open and save them
in Word2003, the problem disappears. The problem is reproduceable using Word97.

The proposed patch simply checks if the computed index is within bounds. This is
probably not addressing the root of the problem, but I could not come up with
something more intelligent.

I will add the patch and a word document which has this problem.
Comment 1 Nico Verwer 2007-12-14 02:33:59 UTC
Created attachment 21275 [details]
Word document causing the exception

When you open and save this file in Word2003, the problem disappears. But it
does happen when you use Word97.
Comment 2 Nico Verwer 2007-12-14 02:34:40 UTC
Created attachment 21276 [details]
Patch for this bug
Comment 3 Nick Burch 2007-12-17 06:19:22 UTC
Thanks for this patch, it has been applied