summaryrefslogtreecommitdiff
path: root/svtools/source/svrtf/svparser.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-06 12:57:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-06 18:33:02 +0100
commite4551b905e12aa92b7509d9b994bfae5dec3d8e0 (patch)
treef5fae8db42321ea918db50b756c7b24434afae55 /svtools/source/svrtf/svparser.cxx
parentf037207675010fdff2c1968a67fae5b0c2c34331 (diff)
ofz infinite loop
Change-Id: Iae9faaa86e4b3edb9a1fdfe9c6b67eee211c19a9 Reviewed-on: https://gerrit.libreoffice.org/44361 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 'svtools/source/svrtf/svparser.cxx')
-rw-r--r--svtools/source/svrtf/svparser.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 2d1be0e3e405..bfcc511a8490 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -76,6 +76,7 @@ SvParser<T>::SvParser( SvStream& rIn, sal_uInt8 nStackSize )
, nlLineNr( 1 )
, nlLinePos( 1 )
, pImplData( nullptr )
+ , m_nTokenIndex(0)
, nTokenValue( 0 )
, bTokenHasValue( false )
, eState( SvParserState::NotStarted )
@@ -476,6 +477,7 @@ T SvParser<T>::GetNextToken()
bTokenHasValue = pTokenStackPos->bTokenHasValue;
aToken = pTokenStackPos->sToken;
nRet = pTokenStackPos->nTokenId;
+ ++m_nTokenIndex;
}
// no, now push actual value on stack
else if( SvParserState::Working == eState )
@@ -484,6 +486,7 @@ T SvParser<T>::GetNextToken()
pTokenStackPos->nTokenValue = nTokenValue;
pTokenStackPos->bTokenHasValue = bTokenHasValue;
pTokenStackPos->nTokenId = nRet;
+ ++m_nTokenIndex;
}
else if( SvParserState::Accepted != eState && SvParserState::Pending != eState )
eState = SvParserState::Error; // an error occurred
@@ -502,6 +505,8 @@ T SvParser<T>::SkipToken( short nCnt ) // "skip" n Tokens backward
nTmp = nTokenStackSize;
nTokenStackPos = sal_uInt8(nTmp);
+ m_nTokenIndex -= nTmp;
+
// restore values
aToken = pTokenStackPos->sToken;
nTokenValue = pTokenStackPos->nTokenValue;