summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/calcmove.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-06-26 19:02:18 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-06-27 10:43:28 +0200
commitf8e4845fec50affc20272600a4baf87554b055fb (patch)
tree798557d19b518fa7ba3625b0589a43808034e1af /sw/source/core/layout/calcmove.cxx
parent459de9c585505b43acd184c00a0251bf7a7c8768 (diff)
tdf#125751 sw: tweak assert in SwFrame::PrepareMake() a bit more
This fixes 2 cases of the assert that was added in commit e14056e6e88d9b8d988b7b88b2776a8fc952031b * tdf#125751 bugdoc would assert because on a page there were a bunch of empty section frames preceding 2 SwTextFrames; the first SwTextFrame moved backwards skipping over the empty section frames, hence the second SwTextFrame is not the mpNext of the first one's follow * writerfilter_null_ptr_deref.sample had a SwTextNode with >80k characters; turns out there is a check in SwTextFrame::CalcFollow() to format only up to 10 follow frames, so the result is 2 follow frames on the same page Change-Id: Ia08afd5a0e227d0613421d74b469c409ee91cfca Reviewed-on: https://gerrit.libreoffice.org/74748 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/core/layout/calcmove.cxx')
-rw-r--r--sw/source/core/layout/calcmove.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 874168d40fcb..c142221cedc5 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -326,7 +326,13 @@ void SwFrame::PrepareMake(vcl::RenderContext* pRenderContext)
&& SwFlowFrame::CastFlowFrame(GetUpper()->Lower())
&& SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow(
SwFlowFrame::CastFlowFrame(GetUpper()->Lower()))
- && GetUpper()->Lower()->GetNext() == this));
+ && (GetUpper()->Lower()->GetNext() == this
+ // if it's more than 10 pages long...
+ || (SwFlowFrame::CastFlowFrame(GetUpper()->Lower())->GetFollow()
+ == SwFlowFrame::CastFlowFrame(GetUpper()->Lower()->GetNext())
+ && GetUpper()->Lower()->GetNext()->GetNext() == this)
+ // pre-existing empty section frames may end up between them...
+ || GetUpper()->Lower()->GetNext()->IsSctFrame())));
break; // tdf#119109 frame was moved backward, prevent
// FindNext() returning a frame inside this if
} // this is a table!
@@ -455,7 +461,13 @@ void SwFrame::PrepareCursor()
&& SwFlowFrame::CastFlowFrame(GetUpper()->Lower())
&& SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow(
SwFlowFrame::CastFlowFrame(GetUpper()->Lower()))
- && GetUpper()->Lower()->GetNext() == this));
+ && (GetUpper()->Lower()->GetNext() == this
+ // if it's more than 10 pages long...
+ || (SwFlowFrame::CastFlowFrame(GetUpper()->Lower())->GetFollow()
+ == SwFlowFrame::CastFlowFrame(GetUpper()->Lower()->GetNext())
+ && GetUpper()->Lower()->GetNext()->GetNext() == this)
+ // pre-existing empty section frames may end up between them...
+ || GetUpper()->Lower()->GetNext()->IsSctFrame())));
break; // tdf#119109 frame was moved backward, prevent
// FindNext() returning a frame inside this if
} // this is a table!