Kaydet (Commit) fc0bd380 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#73466 SwTxtSizeInfo / SwTxtInputFldPortion: invalid string access

Change-Id: Ibd74e3b0cd45fa3bf6fd4135866b22acd16e372e
üst d320760d
...@@ -268,7 +268,7 @@ public: ...@@ -268,7 +268,7 @@ public:
inline const SwViewOption &GetOpt() const { return *m_pOpt; } inline const SwViewOption &GetOpt() const { return *m_pOpt; }
inline const OUString &GetTxt() const { return *m_pTxt; } inline const OUString &GetTxt() const { return *m_pTxt; }
inline sal_Unicode GetChar( const sal_Int32 nPos ) const 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; KSHORT GetTxtHeight() const;
......
...@@ -780,7 +780,7 @@ sal_Bool SwTxtInputFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &r ...@@ -780,7 +780,7 @@ sal_Bool SwTxtInputFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &r
{ {
--nLen; --nLen;
} }
rTxt = rInf.GetTxt().copy( nIdx, nLen ); rTxt = rInf.GetTxt().copy( nIdx, std::min( nLen, rInf.GetTxt().getLength() - nIdx ) );
return sal_True; return sal_True;
} }
......
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