summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Andler <scislac@gmail.com>2009-10-05 20:47:05 +0000
committerscislac <scislac@users.sourceforge.net>2009-10-05 20:47:05 +0000
commit4f6b04e92c3ed3aa02908967f76bd14bb02926d2 (patch)
tree93ec37f4b3d4011aa12a7b50dcafc5689b25dde8 /src
parentFix for 419577 by Johan (diff)
downloadinkscape-4f6b04e92c3ed3aa02908967f76bd14bb02926d2.tar.gz
inkscape-4f6b04e92c3ed3aa02908967f76bd14bb02926d2.zip
Patch by Johan to fix crashing by undefined path parameters in 4 LPEs
(bzr r8723)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/live_effects/lpe-envelope.cpp9
-rw-r--r--src/live_effects/lpe-interpolate.cpp7
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp5
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp7
4 files changed, 26 insertions, 2 deletions
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index a730f14ff..abd975b4e 100755
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -69,6 +69,15 @@ LPEEnvelope::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
using namespace Geom;
+ // Don't allow empty path parameters:
+ if ( bend_path1.get_pathvector().empty()
+ || bend_path2.get_pathvector().empty()
+ || bend_path3.get_pathvector().empty()
+ || bend_path4.get_pathvector().empty() )
+ {
+ return pwd2_in;
+ }
+
/*
The code below is inspired from the Bend Path code developed by jfb and mgsloan
Please, read it before tring to understand this one
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index e19d2e6e7..e77a392e9 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -52,8 +52,13 @@ LPEInterpolate::~LPEInterpolate()
Geom::PathVector
LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
{
- if ( (path_in.size() < 2) || (number_of_steps < 2))
+ if ( (path_in.size() < 2) || (number_of_steps < 2)) {
return path_in;
+ }
+ // Don't allow empty path parameter:
+ if ( trajectory_path.get_pathvector().empty() ) {
+ return path_in;
+ }
std::vector<Geom::Path> path_out;
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index cd724b70e..a3a0faf37 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -60,6 +60,11 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem)
std::vector<Geom::Path>
LPEMirrorSymmetry::doEffect_path (std::vector<Geom::Path> const & path_in)
{
+ // Don't allow empty path parameter:
+ if ( reflection_line.get_pathvector().empty() ) {
+ return path_in;
+ }
+
std::vector<Geom::Path> path_out;
if (!discard_orig_path) {
path_out = path_in;
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index 29c5517bf..45b2b67b4 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -33,7 +33,7 @@ B is a map t --> B(t) = ( a(t), b(t) ).
The first step is to re-parametrize B by its arc length: this is the parametrization in which a point p on B is located by its distance s from start. One obtains a new map s --> U(s) = (a'(s),b'(s)), that still describes the same path B, but where the distance along B from start to
U(s) is s itself.
-We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90°. Call this normal vector N(s).
+We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90�. Call this normal vector N(s).
The basic deformation associated to B is then given by:
@@ -104,6 +104,11 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
{
using namespace Geom;
+ // Don't allow empty path parameter:
+ if ( pattern.get_pathvector().empty() ) {
+ return pwd2_in;
+ }
+
/* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */
Piecewise<D2<SBasis> > output;
std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > pre_output;