Kaydet (Commit) c407fff2 authored tarafından Eike Rathke's avatar Eike Rathke

prevent string access out of bounds

Though only the closing 0-character and the following check excludes that,
dbgutil asserts.

Change-Id: Ife1299042a60f6f058c4cf58b406d1cc022786a7
üst 77a8cf7e
......@@ -814,18 +814,21 @@ short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr,
switch (cToken)
{
case '/': // AM/PM, A/P
cNext = rStr[nPos];
if ( cNext == 'P' || cNext == 'p' )
if (nPos < rStr.getLength())
{
sal_Int32 nLen = sSymbol.getLength();
if ( 1 <= nLen &&
(sSymbol[0] == 'A' || sSymbol[0] == 'a') &&
(nLen == 1 ||
(nLen == 2 && (sSymbol[1] == 'M' || sSymbol[1] == 'm')
&& (rStr[nPos + 1] == 'M' || rStr[nPos + 1] == 'm'))))
cNext = rStr[nPos];
if ( cNext == 'P' || cNext == 'p' )
{
sSymbol += OUStringLiteral1(cToken);
bDontStop = true;
sal_Int32 nLen = sSymbol.getLength();
if ( 1 <= nLen &&
(sSymbol[0] == 'A' || sSymbol[0] == 'a') &&
(nLen == 1 ||
(nLen == 2 && (sSymbol[1] == 'M' || sSymbol[1] == 'm')
&& (rStr[nPos + 1] == 'M' || rStr[nPos + 1] == 'm'))))
{
sSymbol += OUStringLiteral1(cToken);
bDontStop = true;
}
}
}
break;
......
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