[Libreoffice-commits] core.git: linguistic/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Nov 25 10:15:43 UTC 2018
linguistic/source/gciterator.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit d82349e3fcc87b7a9f52a009b14c5e3336a39700
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Nov 24 22:01:16 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Nov 25 11:15:23 2018 +0100
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: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 557ca5d62c06..9e1e11532080 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -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();
}
More information about the Libreoffice-commits
mailing list