diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2013-08-21 09:39:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-21 13:20:46 +0100 |
commit | 199eb7607cfb02ce9a68bff22c37aca91a8e9fb8 (patch) | |
tree | fae747e4e124eaeeec402c6e2361d9bc5164ce8b /svgio/source | |
parent | 172c37522bca256b1d0bd9f966d06f49845ba102 (diff) |
Related: #i122600# access memory problem in SvgSvgNode::getCurrentViewPort
(cherry picked from commit d41dc0bbe76922fee4ce177ecac0d84b9efc4206)
Conflicts:
svgio/inc/svgio/svgreader/svgnode.hxx
svgio/inc/svgio/svgreader/svgtools.hxx
Change-Id: Ie4d5cd29461845edb5b8a57fe639302947d80ebd
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgmarkernode.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpatternnode.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgsvgnode.cxx | 10 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 17 |
5 files changed, 19 insertions, 20 deletions
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx index 94eb24a3037c..dd900e4e7a0c 100644 --- a/svgio/source/svgreader/svgmarkernode.cxx +++ b/svgio/source/svgreader/svgmarkernode.cxx @@ -190,11 +190,11 @@ namespace svgio return aPrimitives; } - const basegfx::B2DRange* SvgMarkerNode::getCurrentViewPort() const + const basegfx::B2DRange SvgMarkerNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } else { diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index e1698e81c472..d25f6daf3dbe 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -479,7 +479,7 @@ namespace svgio } } - const basegfx::B2DRange* SvgNode::getCurrentViewPort() const + const basegfx::B2DRange SvgNode::getCurrentViewPort() const { if(getParent()) { @@ -487,7 +487,7 @@ namespace svgio } else { - return 0; + return basegfx::B2DRange(); // return empty B2DRange } } diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx index dd406394e78a..c743caa8e175 100644 --- a/svgio/source/svgreader/svgpatternnode.cxx +++ b/svgio/source/svgreader/svgpatternnode.cxx @@ -287,11 +287,11 @@ namespace svgio return aPrimitives; } - const basegfx::B2DRange* SvgPatternNode::getCurrentViewPort() const + const basegfx::B2DRange SvgPatternNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } else { diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 8524a016c3e5..5798fd739738 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -600,11 +600,11 @@ namespace svgio } } - const basegfx::B2DRange* SvgSvgNode::getCurrentViewPort() const + const basegfx::B2DRange SvgSvgNode::getCurrentViewPort() const { if(getViewBox()) { - return getViewBox(); + return *(getViewBox()); } else // viewport should be given by x, y, width, and height { @@ -628,7 +628,7 @@ namespace svgio if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute && bHeightIsAbsolute) { - return &basegfx::B2DRange(fX, fY, fX+fW, fY+fH); + return basegfx::B2DRange(fX, fY, fX+fW, fY+fH); } else // try to resolve relative values { @@ -671,7 +671,7 @@ namespace svgio if (bXIsAbsolute && bYIsAbsolute && bWidthIsAbsolute && bHeightIsAbsolute) { - return &basegfx::B2DRange(fX, fY, fX+fW, fY+fH); + return basegfx::B2DRange(fX, fY, fX+fW, fY+fH); } else // relative values could not be resolved, there exists no fallback { @@ -690,7 +690,7 @@ namespace svgio double fH( bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : 0.0); if (bWidthIsAbsolute && bHeightIsAbsolute) { - return &basegfx::B2DRange(0.0, 0.0, fW, fH); + return basegfx::B2DRange(0.0, 0.0, fW, fH); } else // no fallback exists { diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 9ace14f5b0f4..8b5454dfeb2f 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -226,40 +226,39 @@ namespace svgio case Unit_percent: { double fRetval(mfNumber * 0.01); - const basegfx::B2DRange* pViewPort = rInfoProvider.getCurrentViewPort(); + basegfx::B2DRange aViewPort = rInfoProvider.getCurrentViewPort(); - if(!pViewPort) + if ( aViewPort.isEmpty() ) { #ifdef DBG_UTIL myAssert(rtl::OUString::createFromAscii("Design error, this case should have been handled in the caller")); #endif // no viewPort, assume a normal page size (A4) - static basegfx::B2DRange aDinA4Range( + aViewPort = basegfx::B2DRange( 0.0, 0.0, 210.0 * F_SVG_PIXEL_PER_INCH / 2.54, 297.0 * F_SVG_PIXEL_PER_INCH / 2.54); - pViewPort = &aDinA4Range; } - if(pViewPort) + if ( !aViewPort.isEmpty() ) { if(xcoordinate == aNumberType) { // it's a x-coordinate, relative to current width (w) - fRetval *= pViewPort->getWidth(); + fRetval *= aViewPort.getWidth(); } else if(ycoordinate == aNumberType) { // it's a y-coordinate, relative to current height (h) - fRetval *= pViewPort->getHeight(); + fRetval *= aViewPort.getHeight(); } else // length { // it's a length, relative to sqrt(w*w + h*h)/sqrt(2) - const double fCurrentWidth(pViewPort->getWidth()); - const double fCurrentHeight(pViewPort->getHeight()); + const double fCurrentWidth(aViewPort.getWidth()); + const double fCurrentHeight(aViewPort.getHeight()); const double fCurrentLength( sqrt(fCurrentWidth * fCurrentWidth + fCurrentHeight * fCurrentHeight)/sqrt(2.0)); |