Prevent infinite recursion (leading to stack overflow) on broken documents where a PAP claims to be its own parent
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@391084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b57714f465
commit
59121bead0
@ -230,10 +230,16 @@ public class StyleSheet implements HDFType
|
||||
{
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user