summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-08-02 09:39:43 +0100
committerMichael Stahl <mstahl@redhat.com>2017-08-07 22:36:57 +0200
commit40ca8f569c9c7f24e94af3688ff32f5679c2f8f8 (patch)
treeef47fbe42db5a6657281e7b199bed5cbca2cd75b
parentc349ea47a72c92d39aed4649afe493dc7911229e (diff)
Resolves: ofz#2833 null deref
Change-Id: I021a716aa76d430a1d3c6fac2dddec4daa01e563 Reviewed-on: https://gerrit.libreoffice.org/40669 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sc/qa/unit/data/slk/pass/numfmt.slk2
-rw-r--r--svl/source/numbers/zforscan.cxx19
2 files changed, 13 insertions, 8 deletions
diff --git a/sc/qa/unit/data/slk/pass/numfmt.slk b/sc/qa/unit/data/slk/pass/numfmt.slk
new file mode 100644
index 000000000000..85ea7b65c8f2
--- /dev/null
+++ b/sc/qa/unit/data/slk/pass/numfmt.slk
@@ -0,0 +1,2 @@
+
+P;P  s  0 0 \ No newline at end of file
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 363a6219137e..2f08c600730d 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -2350,17 +2350,20 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
OUString& rStr = sStrArray[i];
i++;
- nPos = nPos + sStrArray[i].getLength();
- nCounter++;
- while (i < nAnzStrings &&
- sStrArray[i][0] == '0')
+ if (i < nAnzStrings)
{
- rStr += sStrArray[i];
nPos = nPos + sStrArray[i].getLength();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
nCounter++;
- i++;
+ while (i < nAnzStrings &&
+ sStrArray[i][0] == '0')
+ {
+ rStr += sStrArray[i];
+ nPos = nPos + sStrArray[i].getLength();
+ nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ nCounter++;
+ i++;
+ }
}
}
else