[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 10 01:35:59 PST 2014


 sw/source/core/text/inftxt.hxx |    2 +-
 sw/source/core/text/portxt.cxx |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit fc0bd38051c7c8f4c68a1407aed32a96b2564510
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 10 10:32:12 2014 +0100

    fdo#73466 SwTxtSizeInfo / SwTxtInputFldPortion: invalid string access
    
    Change-Id: Ibd74e3b0cd45fa3bf6fd4135866b22acd16e372e

diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 51f42eb..c429690 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 5be6852..815ea8f 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;
 }


More information about the Libreoffice-commits mailing list