diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-24 22:01:16 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-25 11:15:23 +0100 |
commit | d82349e3fcc87b7a9f52a009b14c5e3336a39700 (patch) | |
tree | 0fb4b3903739072c43b23e2d729e755ef843565d /linguistic | |
parent | f2cd9c0c789b5825b4d5bb84b352d089e231e527 (diff) |
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@collabora.com>
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/source/gciterator.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
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(); } |