Kaydet (Commit) 232b93e7 authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Eike Rathke

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
Reviewed-on: https://gerrit.libreoffice.org/2007Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst e86ce65d
...@@ -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