filter/source/graphicfilter/icgm/cgm.cxx | 13 ++++++++++++- filter/source/graphicfilter/icgm/cgm.hxx | 3 ++- sd/qa/unit/data/cgm/fail/recurse-1.cgm |binary 3 files changed, 14 insertions(+), 2 deletions(-)
New commits: commit 4d66989d1ebac53ff8b2af7d17642e3ab688a317 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Apr 9 18:51:31 2017 +0100 ofz#1078 cgm infinite recurse Change-Id: I6ba4c6a432f1dd150591f8d9b0f03e248a97c33e diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index 714c4d73757e..d3669fe703d3 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -51,6 +51,7 @@ CGM::CGM(uno::Reference< frame::XModel > const & rModel) , mbPictureBody(false) , mbFigure(false) , mbFirstOutPut(false) + , mbInDefaultReplacement(false) , mnAct4PostReset(0) , mpBitmapInUse(nullptr) , mpChart(nullptr) @@ -620,8 +621,16 @@ void CGM::ImplDoClass() void CGM::ImplDefaultReplacement() { - if ( !maDefRepList.empty() ) + if (!maDefRepList.empty()) { + if (mbInDefaultReplacement) + { + SAL_WARN("filter", "recursion in ImplDefaultReplacement"); + return; + } + + mbInDefaultReplacement = true; + sal_uInt32 nOldEscape = mnEscape; sal_uInt32 nOldElementClass = mnElementClass; sal_uInt32 nOldElementID = mnElementID; @@ -663,6 +672,8 @@ void CGM::ImplDefaultReplacement() mnParaSize = mnElementSize = nOldElementSize; mpSource = pOldBuf; mpEndValidSource = pOldEndValidSource; + + mbInDefaultReplacement = false; } } diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index 4da49ea302de..a7c5d04d9d6d 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -64,7 +64,8 @@ class CGM bool mbPictureBody; bool mbFigure; bool mbFirstOutPut; - sal_uInt32 mnAct4PostReset; + bool mbInDefaultReplacement; + sal_uInt32 mnAct4PostReset; CGMBitmap* mpBitmapInUse; CGMChart* mpChart; // if sal_True->"SHWSLIDEREC" // otherwise "BEGINPIC" commands diff --git a/sd/qa/unit/data/cgm/fail/recurse-1.cgm b/sd/qa/unit/data/cgm/fail/recurse-1.cgm new file mode 100644 index 000000000000..4ba3b95de4b0 Binary files /dev/null and b/sd/qa/unit/data/cgm/fail/recurse-1.cgm differ
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits