summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-03-10 13:53:45 +0100
committerEike Rathke <erack@redhat.com>2017-03-10 13:58:17 +0100
commitfe73eff36718b6d99d0cf92d750c457872cc4dcc (patch)
tree8898f4b8df72c8f46ae95fa39a2485275d459ab0 /svl
parentc407fff205a270e02fe07885805b7250e71c28f8 (diff)
guard against a (theoretical?) endless loop of blanks only
Change-Id: I68d6cca1b359aa8fba42663bddb1107c31102415
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 91c36d43b25f..4bd1a9e8349e 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2838,8 +2838,10 @@ bool SvNumberformat::ImpGetFractionOutput(double fNumber,
bRes |= ImpNumberFill(sDiv, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRAC);
if ( !bHideFraction && sDenominatorFormat.getLength() > 0 )
{
+ // Guard against a (theoretical?) endless loop of blanks only.
+ sal_Int32 n = sDiv.getLength();
sal_Int32 nDenominatorLen = sDenominatorFormat.getLength();
- while ( sDiv[0] == ' ' ) // left align denominator
+ while ( n-- > 0 && sDiv[0] == ' ' ) // left align denominator
{
if (sDiv.getLength() <= nDenominatorLen)
sDiv.append(" ");