diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-10 10:32:12 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-03-22 15:21:02 +0100 |
commit | e7baa6fe82c9d4f8bc6841f82f04088e664dda08 (patch) | |
tree | 4acd7aec1d7c26f1a5aca046d7eb96116dc1d8df | |
parent | 3d53b2730eeabd06dfd6ad183c1d12b15836b777 (diff) |
fdo#73466 SwTxtSizeInfo / SwTxtInputFldPortion: invalid string access
Change-Id: Ibd74e3b0cd45fa3bf6fd4135866b22acd16e372e
(cherry picked from commit fc0bd38051c7c8f4c68a1407aed32a96b2564510)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
-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 6602f94b3594..d4f19dd363d1 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 ca0eaf50ac20..6d6c94a960ba 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; } |