Author: nick
Date: Mon Apr 3 09:46:01 2006
New Revision: 391084
URL: http://svn.apache.org/viewcvs?rev=391084&view=rev
Log:
Prevent infinite recursion (leading to stack overflow) on broken documents
where a PAP claims to be its own parent
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
URL:
http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java?rev=391084&r1=391083&r2=391084&view=diff
==============================================================================
---
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
(original)
+++
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
Mon Apr 3 09:46:01 2006
@@ -230,10 +230,16 @@
{
parentPAP = _styleDescriptions[baseIndex].getPAP();
- if(parentPAP == null)
+ if(parentPAP == null)
{
- createPap(baseIndex);
- parentPAP = _styleDescriptions[baseIndex].getPAP();
+ if(baseIndex == istd) {
+ // Oh dear, style claims that it is its own parent
+ throw new IllegalStateException("Pap style " + istd +
" claimed to have itself as its parent, which isn't allowed");
+ } else {
+ // Create the parent style
+ createPap(baseIndex);
+ parentPAP = _styleDescriptions[baseIndex].getPAP();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/