Kaydet (Commit) 8544d42f authored tarafından Matteo Casalin's avatar Matteo Casalin

SAL_WARN_IF ScCsvSplits::Insert exceeds its maximum supported size

and cast size() to sal_uInt32 in ScCsvSplits::Count()

Change-Id: I35de736702a58e82df6fe90396fe748161f1ff8d
üst c3cc5742
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <algorithm> #include <algorithm>
#include <sal/log.hxx>
bool ScCsvSplits::Insert( sal_Int32 nPos ) bool ScCsvSplits::Insert( sal_Int32 nPos )
{ {
if (nPos < 0) if (nPos < 0)
...@@ -31,6 +33,9 @@ bool ScCsvSplits::Insert( sal_Int32 nPos ) ...@@ -31,6 +33,9 @@ bool ScCsvSplits::Insert( sal_Int32 nPos )
if (aIter != maVec.end() && *aIter == nPos) if (aIter != maVec.end() && *aIter == nPos)
return false; 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 ); maVec.insert( aIter, nPos );
return true; return true;
} }
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
/** Returns the number of splits. */ /** Returns the number of splits. */
sal_uInt32 Count() const sal_uInt32 Count() const
{ return maVec.size(); } { return static_cast<sal_uInt32>(maVec.size()); }
/** Returns the position of the specified split. */ /** Returns the position of the specified split. */
sal_Int32 GetPos( sal_uInt32 nIndex ) const; sal_Int32 GetPos( sal_uInt32 nIndex ) const;
/** Returns the position of the specified split. */ /** Returns the position of the specified split. */
......
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