diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-17 08:10:24 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-10-27 13:59:08 +0100 |
commit | 8544d42fdb049d23bf569e415af64721cb464b16 (patch) | |
tree | f2780d3a5ed8178dea26fbb75747ea982ed5c8ad /sc/source | |
parent | c3cc574235c7db2214c26860554c725ff3976161 (diff) |
SAL_WARN_IF ScCsvSplits::Insert exceeds its maximum supported size
and cast size() to sal_uInt32 in ScCsvSplits::Count()
Change-Id: I35de736702a58e82df6fe90396fe748161f1ff8d
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/dbgui/csvsplits.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/csvsplits.hxx | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/csvsplits.cxx b/sc/source/ui/dbgui/csvsplits.cxx index aaa0952d6b7b..aa53a88c3f64 100644 --- a/sc/source/ui/dbgui/csvsplits.cxx +++ b/sc/source/ui/dbgui/csvsplits.cxx @@ -21,6 +21,8 @@ #include <algorithm> +#include <sal/log.hxx> + bool ScCsvSplits::Insert( sal_Int32 nPos ) { if (nPos < 0) @@ -31,6 +33,9 @@ bool ScCsvSplits::Insert( sal_Int32 nPos ) if (aIter != maVec.end() && *aIter == nPos) return false; + SAL_WARN_IF(maVec.size()>=static_cast<std::size_t>(SAL_MAX_UINT32-1), + "sc.ui", "ScCsvSplits::Insert: too many elements in vector"); + maVec.insert( aIter, nPos ); return true; } diff --git a/sc/source/ui/inc/csvsplits.hxx b/sc/source/ui/inc/csvsplits.hxx index 3a07f83b0b69..7ab80e34a76f 100644 --- a/sc/source/ui/inc/csvsplits.hxx +++ b/sc/source/ui/inc/csvsplits.hxx @@ -68,7 +68,7 @@ public: /** Returns the number of splits. */ sal_uInt32 Count() const - { return maVec.size(); } + { return static_cast<sal_uInt32>(maVec.size()); } /** Returns the position of the specified split. */ sal_Int32 GetPos( sal_uInt32 nIndex ) const; /** Returns the position of the specified split. */ |