diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-21 11:27:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-21 12:01:35 +0100 |
commit | 6071feec26743dacff1060658e57d5cf62cde2a8 (patch) | |
tree | 678349d035162c2fc26d2c8f8c72ce4039031e37 | |
parent | d08479edf59ea8b2390f6dd83b644883781f09bb (diff) |
if read string was truncated, then truncate attributes range to match
Change-Id: I3501d31e0310481a5872e537bf53ad2faaf25779
-rw-r--r-- | sw/qa/core/data/ww6/pass/crash-2.doc | bin | 0 -> 6680 bytes | |||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/sw/qa/core/data/ww6/pass/crash-2.doc b/sw/qa/core/data/ww6/pass/crash-2.doc Binary files differnew file mode 100644 index 000000000000..f155e973f7bd --- /dev/null +++ b/sw/qa/core/data/ww6/pass/crash-2.doc diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 39b301eb55d2..6a193700b7c2 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -865,7 +865,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, // TxbxText() holt aus WW-File den Text und gibt diesen und den Anfangs- und // den um -2 (bzw. -1 bei Ver8) korrigierten End-Cp zurueck -bool SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, long nStartCp, long nEndCp, ManTypes eType) +sal_Int32 SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, long nStartCp, long nEndCp, ManTypes eType) { WW8_CP nOffset = m_pWwFib->GetBaseCp(eType); @@ -884,23 +884,24 @@ bool SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, long nStartCp, rString = rString.copy(0, nLen-1); rString = rString.replace( 0xb, 0xa ); - return true; + return nLen; } } - return false; + return 0; } OutlinerParaObject* SwWW8ImplReader::ImportAsOutliner(OUString &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType) { OutlinerParaObject* pRet = 0; - if (GetRangeAsDrawingString( rString, nStartCp, nEndCp, eType )) + sal_Int32 nLen = GetRangeAsDrawingString(rString, nStartCp, nEndCp, eType); + if (nLen > 0) { if (!m_pDrawEditEngine) m_pDrawEditEngine = new EditEngine(0); m_pDrawEditEngine->SetText(rString); - InsertAttrsAsDrawingAttrs(nStartCp, nEndCp, eType); + InsertAttrsAsDrawingAttrs(nStartCp, nStartCp+nLen, eType); // Annotations typically begin with a (useless) 0x5 if ((eType == MAN_AND) && m_pDrawEditEngine->GetTextLen()) @@ -950,8 +951,8 @@ SwFrameFormat* SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, OUString aString; WW8_CP nStartCp, nEndCp; bool bContainsGraphics = false; - bool bTextWasRead = GetTxbxTextSttEndCp( nStartCp, nEndCp, nTxBxS, - nSequence ) && GetRangeAsDrawingString( aString, nStartCp, nEndCp, eType ); + bool bTextWasRead = GetTxbxTextSttEndCp(nStartCp, nEndCp, nTxBxS, nSequence) && + GetRangeAsDrawingString(aString, nStartCp, nEndCp, eType) > 0; if (!m_pDrawEditEngine) m_pDrawEditEngine = new EditEngine(0); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index fbd103163932..b13230d6d69b 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1581,7 +1581,7 @@ private: bool GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, sal_uInt16 nTxBxS, sal_uInt16 nSequence); - bool GetRangeAsDrawingString(OUString& rString, long StartCp, long nEndCp, ManTypes eType); + sal_Int32 GetRangeAsDrawingString(OUString& rString, long StartCp, long nEndCp, ManTypes eType); OutlinerParaObject* ImportAsOutliner(OUString &rString, WW8_CP nStartCp, WW8_CP nEndCp, ManTypes eType); SwFrameFormat* InsertTxbxText(SdrTextObj* pTextObj, Size* pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp, SwFrameFormat* pFlyFormat, |