summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-10-15 17:05:33 +0200
committerDavid Tardon <dtardon@redhat.com>2014-10-15 17:07:36 +0200
commit1ad97f9b803d07702d52f44b2d6ce7235ff9400a (patch)
treefc6933f6ffe52cd3ec019ba8c8bc335718d0cc63 /i18npool
parent4a97029ce71262395620b71633b309f3e6bb6f54 (diff)
avoid out-of-bounds access when iterating code points
Change-Id: I583e49180b37705ea124c0d88c2e2a8cb1470dfe
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/breakiterator/xdictionary.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index 567a2db1aced..6f7c1968fea0 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -403,7 +403,9 @@ WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary& wordBou
Boundary xdictionary::previousWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType)
{
// looking for the first non-whitespace character from anyPos
- sal_uInt32 ch = rText.iterateCodePoints(&anyPos, -1);
+ sal_uInt32 ch = 0;
+ if (anyPos > 0)
+ rText.iterateCodePoints(&anyPos, -1);
while (anyPos > 0 && u_isWhitespace(ch)) ch = rText.iterateCodePoints(&anyPos, -1);