summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-31 16:00:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-02 11:07:55 +0200
commit2f3684b2289a8c46dc6144064a452cc529400f28 (patch)
treefc460328cc6963b9a156c23395ce8f15c70e878d /sw
parent4804a1474ccba8df57f0a0151bd69237e82eb618 (diff)
[API CHANGE] add some more asserts to the string functions
rtl_[u]String_alloc now requires that the length be >= 0. Since this function is only @since Libreoffice 4.1, it is unlikely to be widely used externally. Removed some unit tests that were testing invalid or out of range paramers, which are already not allowed according to the documented contract of those functions. The change in writerfilter is because the new asserts triggered when running testFdo74745 The change in SwTextNode::EraseText is because testFdo60842 triggered the assert in replaceAt. The change in SwFieldSlot::SwFieldSlot is because testMoveRange::Import_Export_Import triggered the assert in replaceAt. The changes in SwFieldSlot::SwFieldSlot and TabControl::ImplGetItemSize are due to failures in the uitests. Change-Id: Ib317261067649b0de96df12873ce31360cd24681 Reviewed-on: https://gerrit.libreoffice.org/58390 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/porfld.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx3
2 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index a3cb46ea7f68..d76a1d94c053 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -171,7 +171,7 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP
pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
pInf->SetIdx(TextFrameIndex(0));
}
- else
+ else if(nIdx < pOldText->getLength())
{
aText = (*pOldText).replaceAt(sal_Int32(nIdx), 1, aText);
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index e8106bb859fe..4f1b12610b1b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2344,7 +2344,8 @@ void SwTextNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount,
const sal_Int32 nCnt = (nCount==SAL_MAX_INT32)
? m_Text.getLength() - nStartIdx : nCount;
const sal_Int32 nEndIdx = nStartIdx + nCnt;
- m_Text = m_Text.replaceAt(nStartIdx, nCnt, "");
+ if (nEndIdx <= m_Text.getLength())
+ m_Text = m_Text.replaceAt(nStartIdx, nCnt, "");
// GCAttr(); don't remove all empty ones, just the ones that are in the
// range but not at the end of the range.