diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-10 10:32:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-10 10:35:36 +0100 |
commit | fc0bd38051c7c8f4c68a1407aed32a96b2564510 (patch) | |
tree | d9111dd701576b6858ecf1eafdfc52adead4f947 | |
parent | d320760dc1c9d6501d84849219b4d9fc6c62b85b (diff) |
fdo#73466 SwTxtSizeInfo / SwTxtInputFldPortion: invalid string access
Change-Id: Ibd74e3b0cd45fa3bf6fd4135866b22acd16e372e
-rw-r--r-- | sw/source/core/text/inftxt.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/portxt.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 51f42eb5d64c..c42969015683 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -268,7 +268,7 @@ public: inline const SwViewOption &GetOpt() const { return *m_pOpt; } inline const OUString &GetTxt() const { return *m_pTxt; } inline sal_Unicode GetChar( const sal_Int32 nPos ) const - { if (m_pTxt && !m_pTxt->isEmpty()) return (*m_pTxt)[ nPos ]; return 0; } + { if (m_pTxt && nPos < m_pTxt->getLength()) return (*m_pTxt)[ nPos ]; return 0; } KSHORT GetTxtHeight() const; diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 5be6852c7b15..815ea8f96271 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -780,7 +780,7 @@ sal_Bool SwTxtInputFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &r { --nLen; } - rTxt = rInf.GetTxt().copy( nIdx, nLen ); + rTxt = rInf.GetTxt().copy( nIdx, std::min( nLen, rInf.GetTxt().getLength() - nIdx ) ); return sal_True; } |