summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2011-12-21 00:03:38 +0100
committerThorsten Behrens <tbehrens@suse.com>2011-12-22 23:51:56 +0100
commit854dc02f0822511a9a3c17667f4fe992069dd919 (patch)
tree4f97fa50eed220163bfa038b8437b9ffeff06d48 /slideshow
parent643de3b64ed4b71ab48a7f100c90c1c4d5f918cc (diff)
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.
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx77
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx8
2 files changed, 49 insertions, 36 deletions
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
index c3c8dc6ad4e6..06ec310104ab 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -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();
+ }
}
}
}
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index d7cce3bed5a1..c8a307d2782a 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -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,