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(
// okay, found a ParagraphTarget with a valid XShape. Does the shape
// provide the given paragraph?
const DocTreeNode& rTreeNode(
mpShape->getTreeNodeSupplier().getTreeNode(
aTarget.Paragraph,
DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
// CAUTION: the creation of the subset shape
// _must_ stay in the node constructor, since
// Slide::prefetchShow() initializes shape
// attributes right after animation import (or
// the Slide class must be changed).
mpShapeSubset.reset(
new ShapeSubset( mpShape,
rTreeNode,
mpSubsetManager ));
// Override NodeContext, and flag this node as
// a special independent subset one. This is
// important when applying initial attributes:
// independent shape subsets must be setup
// when the slide starts, since they, as their
// name suggest, can have state independent to
// the master shape. The following example
// might illustrate that: a master shape has
// no effect, one of the text paragraphs
// within it has an appear effect. Now, the
// respective paragraph must be invisible when
// the slide is initially shown, and become
// visible only when the effect starts.
mbIsIndependentSubset = true;
// already enable subset right here, the
// setup of initial shape attributes of
// course needs the subset shape
// generated, to apply e.g. visibility
// changes.
mpShapeSubset->enableSubsetShape();
if( aTarget.Paragraph >= 0 &&
mpShape->getTreeNodeSupplier().getNumberOfTreeNodes(
DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH) > aTarget.Paragraph )
{
const DocTreeNode& rTreeNode(
mpShape->getTreeNodeSupplier().getTreeNode(
aTarget.Paragraph,
DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
// CAUTION: the creation of the subset shape
// _must_ stay in the node constructor, since
// Slide::prefetchShow() initializes shape
// attributes right after animation import (or
// the Slide class must be changed).
mpShapeSubset.reset(
new ShapeSubset( mpShape,
rTreeNode,
mpSubsetManager ));
// Override NodeContext, and flag this node as
// a special independent subset one. This is
// important when applying initial attributes:
// independent shape subsets must be setup
// when the slide starts, since they, as their
// name suggest, can have state independent to
// the master shape. The following example
// might illustrate that: a master shape has
// no effect, one of the text paragraphs
// within it has an appear effect. Now, the
// respective paragraph must be invisible when
// the slide is initially shown, and become
// visible only when the effect starts.
mbIsIndependentSubset = true;
// already enable subset right here, the
// 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(
// this up first.
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(
rNodeSupplier.getTreeNode(
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