sw/source/core/layout/layact.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit 00b6602d4c79af5bbcb6fab118740d73c1bcf74e Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Sun Dec 11 14:41:15 2022 -0500 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Dec 13 14:24:04 2022 +0000 Fix infinite loop in sw_ooxmlexport17 unit test on macOS Intel When running the sw_ooxmlexport17 unit test on slower macOS Intel machines, This loop will never end even after 1M+ loops so set a maximum number of loops like is done in the nested while loops. Change-Id: If3a6140e03f21f4a16f6d90be7988c28c8f36753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143947 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit d491791dad8c3a946dac8c4dfd28ef0c4cb65ce5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144030 diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 75662f3374e0..971d2761639e 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -500,8 +500,20 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) return bAgain; }; + int nOuterLoopControlRuns = 0; + const int nOutermoopControlMax = 10000; while ( (pPage && !IsInterrupt()) || m_nCheckPageNum != USHRT_MAX ) { + // Fix infinite loop in sw_ooxmlexport17 unit test + // When running the sw_ooxmlexport17 unit test on slower macOS Intel + // machines, This loop will never end even after 1M+ loops so set a + // maximum number of loops like is done in the nested while loops. + if (++nOuterLoopControlRuns > nOutermoopControlMax) + { + SAL_WARN("sw", "SwLayAction::InternalAction has run too many loops"); + m_bInterrupt = true; + } + // note: this is the only place that consumes and resets m_nCheckPageNum if ((IsInterrupt() || !pPage) && m_nCheckPageNum != USHRT_MAX) {