You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/09/19 12:16:07 UTC
svn commit: r998625 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
Author: nick
Date: Sun Sep 19 10:16:06 2010
New Revision: 998625
URL: http://svn.apache.org/viewvc?rev=998625&view=rev
Log:
Hopefully fix bug #47271 - Avoid infinite loops on broken HWPF documents with a corrupt CHP style with a parent of itself
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=998625&r1=998624&r2=998625&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Sep 19 10:16:06 2010
@@ -34,6 +34,7 @@
<changes>
<release version="3.7-beta3" date="2010-??-??">
+ <action dev="poi-developers" type="fix">47271 - Avoid infinite loops on broken HWPF documents with a corrupt CHP style with a parent of itself</action>
<action dev="poi-developers" type="fix">49936 - Handle HWPF documents with problematic HeaderStories better</action>
<action dev="poi-developers" type="fix">49933 - Support sections in Word 6 and Word 95 files (HWPFOldDocument)</action>
<action dev="poi-developers" type="fix">49941 - Correctly handle space preservation of XSSFRichTextRuns when applying fonts to parts of the string</action>
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java?rev=998625&r1=998624&r2=998625&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java Sun Sep 19 10:16:06 2010
@@ -258,6 +258,16 @@ public final class StyleSheet implements
CharacterProperties chp = sd.getCHP();
byte[] chpx = sd.getCHPX();
int baseIndex = sd.getBaseStyle();
+
+ if(baseIndex == istd) {
+ // Oh dear, this isn't allowed...
+ // The word file seems to be corrupted
+ // Switch to using the nil style so that
+ // there's a chance we can read it
+ baseIndex = NIL_STYLE;
+ }
+
+ // Build and decompress the Chp if required
if(chp == null && chpx != null)
{
CharacterProperties parentCHP = new CharacterProperties();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org