Kaydet (Commit) 6ed233b2 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#39135: Prevent integer overflow & update the character during loop.

These two errors in the code contributed to the reported bug.  Let's
fix them.

Change-Id: If82a1bd4d1e27145b48e722b30388cc9dc4a8a6e
üst c4696e7c
...@@ -155,15 +155,20 @@ void ExpandToTextR1C1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartP ...@@ -155,15 +155,20 @@ void ExpandToTextR1C1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartP
if (c == '\'') if (c == '\'')
break; break;
} }
if (rStartPos == 0)
break;
} }
else if (c == ']') else if (c == ']')
{ {
// Skip until the opening braket. // Skip until the opening braket.
for (--rStartPos; rStartPos > 0; --rStartPos) for (--rStartPos; rStartPos > 0; --rStartPos)
{ {
c = p[rStartPos];
if (c == '[') if (c == '[')
break; break;
} }
if (rStartPos == 0)
break;
} }
else if (!IsText(c)) else if (!IsText(c))
{ {
......
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