hwpfilter/source/hwpreader.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit a9fe7eaa6501e41a01158ae412d4051c6441595b Author: Caolán McNamara <[email protected]> AuthorDate: Sat Oct 11 20:12:10 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 12 13:22:25 2025 +0200 ofz#446998337 Timeout, paragraph parsing triggers self parse reenter Change-Id: I4e1aab441a366c3987b6ab8003d98727f5b20fa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192234 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index cf3e31321f33..c624a20003ef 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -39,6 +39,7 @@ #include <iostream> #include <locale.h> +#include <o3tl/sorted_vector.hxx> #include <sal/types.h> #include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> @@ -70,6 +71,8 @@ struct HwpReaderPrivate pPn = nullptr; pField = nullptr; } + // track what paras are current getting parsed to detect parse loop + o3tl::sorted_vector<HWPPara*> aParaParseStack; bool bFirstPara; bool bInBody; bool bInHeader; @@ -4647,6 +4650,13 @@ void HwpReader::makeOutline(Outline const * hbox) void HwpReader::parsePara(HWPPara * para) { + bool bAlreadyParsing = !d->aParaParseStack.insert(para).second; + if (bAlreadyParsing) + { + SAL_WARN("filter.hwp", "attempt to parse para while already parsing it"); + return; + } + bool bParaStart = false; while (para) { @@ -4691,8 +4701,9 @@ void HwpReader::parsePara(HWPPara * para) bParaStart = false; para = para->Next(); } -} + d->aParaParseStack.erase(para); +} void HwpReader::startEl(const OUString& el) {
