summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-10 11:50:38 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-10-11 12:50:20 +0000
commit11974b31bc5f2718d9f4da47bf376ee37e57deeb (patch)
treec81bd519ef6f8ffb54f4ff5721391a2e4e792060
parentfdo#62994 reportbuilder survive empty formula (diff)
downloadcore-11974b31bc5f2718d9f4da47bf376ee37e57deeb.tar.gz
core-11974b31bc5f2718d9f4da47bf376ee37e57deeb.zip
Prevent out-of-bounds arguments to OUString::copy
...which would somewhat unhelpfully result in returning "!!br0ken!!" (partial backport of 34e951bd7284d2e771c279e3adc3899d191fdad0 "More OUString::copy out-of-bounds fixes") Change-Id: Ibf66d218fe5f0d7b6216795a3b991705d4afda73 Reviewed-on: https://gerrit.libreoffice.org/6185 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/control/field2.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 5ae0453f0bea..080d1fccafbd 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -19,6 +19,8 @@
#include "sal/config.h"
+#include <algorithm>
+
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <tools/rc.h>
@@ -1013,7 +1015,7 @@ static sal_uInt16 ImplCutNumberFromString( OUString& rStr )
++i2;
}
sal_Int32 nValue = rStr.copy(i1, i2-i1).toInt32();
- rStr = rStr.copy(i2+1);
+ rStr = rStr.copy(std::min(i2+1, rStr.getLength()));
return nValue;
}