[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Sat Mar 22 07:12:32 PDT 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 e7baa6fe82c9d4f8bc6841f82f04088e664dda08
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
    (cherry picked from commit fc0bd38051c7c8f4c68a1407aed32a96b2564510)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 6602f94..d4f19dd 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 ca0eaf5..6d6c94a 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