Kaydet (Commit) d82349e3 authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: fix possible buffer over-read when iterating string

V560 A part of conditional expression is always true: nStartPos < nLen.

Change-Id: I2ae8634bd656e857724615d5187a14bd087598eb
Reviewed-on: https://gerrit.libreoffice.org/63958
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst f2cd9c0c
......@@ -167,8 +167,9 @@ static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 nStartPos
sal_Int32 nRes = nStartPos;
if (0 <= nStartPos && nStartPos < nLen)
{
const sal_Unicode* const pEnd = rText.getStr() + nLen;
const sal_Unicode *pText = rText.getStr() + nStartPos;
while (nStartPos < nLen && lcl_IsWhiteSpace( *pText ))
while (pText != pEnd && lcl_IsWhiteSpace(*pText))
++pText;
nRes = pText - rText.getStr();
}
......
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