Kaydet (Commit) 854dc02f authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Fix for fdo#43837 - prevent invalid shape text indices.

Catch a few cases where an invalid text node index is passed into
the shape subsetter.
üst 643de3b6
...@@ -141,42 +141,47 @@ AnimationBaseNode::AnimationBaseNode( ...@@ -141,42 +141,47 @@ AnimationBaseNode::AnimationBaseNode(
// okay, found a ParagraphTarget with a valid XShape. Does the shape // okay, found a ParagraphTarget with a valid XShape. Does the shape
// provide the given paragraph? // provide the given paragraph?
const DocTreeNode& rTreeNode( if( aTarget.Paragraph >= 0 &&
mpShape->getTreeNodeSupplier().getTreeNode( mpShape->getTreeNodeSupplier().getNumberOfTreeNodes(
aTarget.Paragraph, DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH) > aTarget.Paragraph )
DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) ); {
const DocTreeNode& rTreeNode(
// CAUTION: the creation of the subset shape mpShape->getTreeNodeSupplier().getTreeNode(
// _must_ stay in the node constructor, since aTarget.Paragraph,
// Slide::prefetchShow() initializes shape DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
// attributes right after animation import (or
// the Slide class must be changed). // CAUTION: the creation of the subset shape
mpShapeSubset.reset( // _must_ stay in the node constructor, since
new ShapeSubset( mpShape, // Slide::prefetchShow() initializes shape
rTreeNode, // attributes right after animation import (or
mpSubsetManager )); // the Slide class must be changed).
mpShapeSubset.reset(
// Override NodeContext, and flag this node as new ShapeSubset( mpShape,
// a special independent subset one. This is rTreeNode,
// important when applying initial attributes: mpSubsetManager ));
// independent shape subsets must be setup
// when the slide starts, since they, as their // Override NodeContext, and flag this node as
// name suggest, can have state independent to // a special independent subset one. This is
// the master shape. The following example // important when applying initial attributes:
// might illustrate that: a master shape has // independent shape subsets must be setup
// no effect, one of the text paragraphs // when the slide starts, since they, as their
// within it has an appear effect. Now, the // name suggest, can have state independent to
// respective paragraph must be invisible when // the master shape. The following example
// the slide is initially shown, and become // might illustrate that: a master shape has
// visible only when the effect starts. // no effect, one of the text paragraphs
mbIsIndependentSubset = true; // within it has an appear effect. Now, the
// respective paragraph must be invisible when
// already enable subset right here, the // the slide is initially shown, and become
// setup of initial shape attributes of // visible only when the effect starts.
// course needs the subset shape mbIsIndependentSubset = true;
// generated, to apply e.g. visibility
// changes. // already enable subset right here, the
mpShapeSubset->enableSubsetShape(); // setup of initial shape attributes of
// course needs the subset shape
// generated, to apply e.g. visibility
// changes.
mpShapeSubset->enableSubsetShape();
}
} }
} }
} }
......
...@@ -1062,6 +1062,14 @@ bool SlideImpl::applyInitialShapeAttributes( ...@@ -1062,6 +1062,14 @@ bool SlideImpl::applyInitialShapeAttributes(
// this up first. // this up first.
const DocTreeNodeSupplier& rNodeSupplier( pAttrShape->getTreeNodeSupplier() ); const DocTreeNodeSupplier& rNodeSupplier( pAttrShape->getTreeNodeSupplier() );
if( rNodeSupplier.getNumberOfTreeNodes(
DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) <= nParaIndex )
{
OSL_FAIL( "SlideImpl::applyInitialShapeAttributes(): shape found does not "
"provide a subset for requested paragraph index" );
continue;
}
pAttrShape = pAttrShape->getSubset( pAttrShape = pAttrShape->getSubset(
rNodeSupplier.getTreeNode( rNodeSupplier.getTreeNode(
nParaIndex, nParaIndex,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment