Kaydet (Commit) cdd59ee1 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#61638 SmParser::NextToken: don't crash on ending dot

Change-Id: Ia9c168e52a99286910c9e63e0e052671c5259ba8
üst c302a773
...@@ -872,24 +872,30 @@ void SmParser::NextToken() ...@@ -872,24 +872,30 @@ void SmParser::NextToken()
break; break;
case '.': case '.':
{ {
// for compatibility with SO5.2 // Only one character? Then it can't be a number.
// texts like .34 ...56 ... h ...78..90 if (m_nBufferIndex < m_aBufferString.getLength() - 1)
// will be treated as numbers
m_aCurToken.eType = TNUMBER;
m_aCurToken.cMathChar = '\0';
m_aCurToken.nGroup = 0;
m_aCurToken.nLevel = 5;
sal_Int32 nTxtStart = m_nBufferIndex;
sal_Unicode cChar;
do
{ {
cChar = m_aBufferString[ ++m_nBufferIndex ]; // for compatibility with SO5.2
// texts like .34 ...56 ... h ...78..90
// will be treated as numbers
m_aCurToken.eType = TNUMBER;
m_aCurToken.cMathChar = '\0';
m_aCurToken.nGroup = 0;
m_aCurToken.nLevel = 5;
sal_Int32 nTxtStart = m_nBufferIndex;
sal_Unicode cChar;
do
{
cChar = m_aBufferString[ ++m_nBufferIndex ];
}
while ( cChar == '.' || rtl::isAsciiDigit( cChar ) );
m_aCurToken.aText = m_aBufferString.copy( nTxtStart, m_nBufferIndex - nTxtStart );
aRes.EndPos = m_nBufferIndex;
} }
while ( cChar == '.' || rtl::isAsciiDigit( cChar ) ); else
bHandled = false;
m_aCurToken.aText = m_aBufferString.copy( nTxtStart, m_nBufferIndex - nTxtStart );
aRes.EndPos = m_nBufferIndex;
} }
break; break;
case '/': case '/':
......
...@@ -69,6 +69,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\ ...@@ -69,6 +69,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
package/util/package2 \ package/util/package2 \
sax/source/expatwrap/expwrap \ sax/source/expatwrap/expwrap \
sfx2/util/sfx \ sfx2/util/sfx \
starmath/util/sm \
svtools/util/svt \ svtools/util/svt \
sw/util/msword \ sw/util/msword \
sw/util/sw \ sw/util/sw \
......
{\rtf1
{\mmath
{\*\moMathPara
{\*\moMath
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 a}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 =}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 b}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 +}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 c}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 +}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 \hich\af34\dbch\af31505\loch\f34
{\mr\mscr0\msty2 d}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \i\f34\insrsid7877010 .}
}
}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid7877010 \par }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment