diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-15 15:10:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-15 19:25:01 +0200 |
commit | 409441652af3df62e742b9d7a3d80cb6b15214af (patch) | |
tree | fa7fef7b5ee24a755d4f9bbb5258408601fd41b3 /editeng | |
parent | dd84c23bf604c175062cc338b79e9ca362edcb50 (diff) |
ofz#7802 infinite loop
Change-Id: I1b631dec998efb4a689ef13ea29bcff89cf7a47f
Reviewed-on: https://gerrit.libreoffice.org/54377
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 369995b1d293..88a3a1c110bf 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -356,7 +356,10 @@ void SvxRTFParser::ReadStyleTable() case RTF_CHRFMT: case RTF_BRDRDEF: case RTF_TABSTOPDEF: - +#ifndef NDEBUG + auto nEnteringToken = nToken; +#endif + auto nEnteringIndex = m_nTokenIndex; if( RTF_SWGDEFS & nToken) { if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId ) @@ -368,6 +371,17 @@ void SvxRTFParser::ReadStyleTable() } } ReadAttr( nToken, &pStyle->aAttrSet ); + if (m_nTokenIndex == nEnteringIndex - 1) + { + // we called SkipToken to go back one, but + // ReadAttrs read nothing, so on next loop + // of outer while we would end up in the + // same state again (assert that) + assert(nEnteringToken == GetNextToken()); + // and loop endlessly, skip format a token + // instead to avoid that + SkipToken(1); + } break; } break; |