summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-28 14:43:50 +0000
committerAndras Timar <andras.timar@collabora.com>2016-03-01 22:21:48 +0100
commit5109f4e293fe33763548f5cdc75f7d1715e5e5c4 (patch)
tree70050049d03d18ae61ed98abca2749326b133545
parentab31aca23b4c51bb1a3666bd0fe18caa15790777 (diff)
guard against infinite recursion in GetGeometry
(cherry picked from commit 9ec011f6874cf663db54d0420c41d9299e4ed882) (cherry picked from commit 02c113a3ab57d7880bb1f794e192fb42aea078e1) Change-Id: I901f77f5846512cb528f2e14bbc50409fa29bef2 Reviewed-on: https://gerrit.libreoffice.org/20988 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> (cherry picked from commit ab8c84b1b1d14adc0cabbc063ba8a5132a540201)
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx11
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx12
2 files changed, 18 insertions, 5 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 41991e1a9dce..f26c156f1cd1 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -587,9 +587,12 @@ void LwpLayoutMisc::Read(LwpObjectStream* pStrm)
}
LwpMiddleLayout::LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm )
- : LwpVirtualLayout(objHdr, pStrm),
- m_pStyleStuff(new LwpLayoutStyle), m_pMiscStuff(new LwpLayoutMisc)
-{}
+ : LwpVirtualLayout(objHdr, pStrm)
+ , m_pStyleStuff(new LwpLayoutStyle)
+ , m_pMiscStuff(new LwpLayoutMisc)
+ , m_bGettingGeometry(false)
+{
+}
LwpMiddleLayout::~LwpMiddleLayout()
{
@@ -665,7 +668,7 @@ rtl::Reference<LwpObject> LwpMiddleLayout::GetBasedOnStyle()
* @descr: Get the geometry of current layout
*
*/
-LwpLayoutGeometry* LwpMiddleLayout::GetGeometry()
+LwpLayoutGeometry* LwpMiddleLayout::Geometry()
{
if( !m_LayGeometry.IsNull() )
{
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 245847e88423..ee17147befe3 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -282,7 +282,15 @@ public:
virtual bool MarginsSameAsParent() SAL_OVERRIDE;
virtual double GetMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
- LwpLayoutGeometry* GetGeometry();
+ LwpLayoutGeometry* GetGeometry()
+ {
+ if (m_bGettingGeometry)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingGeometry = true;
+ auto pRet = Geometry();
+ m_bGettingGeometry = false;
+ return pRet;
+ }
double GetGeometryHeight();
double GetGeometryWidth();
LwpBorderStuff* GetBorderStuff();
@@ -330,6 +338,7 @@ protected:
void Read() SAL_OVERRIDE;
private:
LwpObjectID m_BasedOnStyle;
+ LwpLayoutGeometry* Geometry();
protected:
enum
{
@@ -348,6 +357,7 @@ protected:
LwpObjectID m_LayBorderStuff;
LwpObjectID m_LayBackgroundStuff;
LwpObjectID m_LayExtBorderStuff;
+ bool m_bGettingGeometry;
public:
LwpObjectID& GetContent() { return m_Content; }
LwpTabOverride* GetTabOverride();