Kaydet (Commit) 1ad97f9b authored tarafından David Tardon's avatar David Tardon

avoid out-of-bounds access when iterating code points

Change-Id: I583e49180b37705ea124c0d88c2e2a8cb1470dfe
üst 4a97029c
...@@ -403,7 +403,9 @@ WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary& wordBou ...@@ -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) Boundary xdictionary::previousWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType)
{ {
// looking for the first non-whitespace character from anyPos // 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); while (anyPos > 0 && u_isWhitespace(ch)) ch = rText.iterateCodePoints(&anyPos, -1);
......
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