sw/qa/core/data/ww6/pass/crash-2.doc |binary sw/source/filter/ww8/ww8graf.cxx | 15 ++++++++------- sw/source/filter/ww8/ww8par.hxx | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-)
New commits: commit e9ef67d14422d7a41ec2d01c52a43c9bbdfe5c54 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Aug 21 11:27:06 2015 +0100 if read string was truncated, then truncate attributes range to match (cherry picked from commit 6071feec26743dacff1060658e57d5cf62cde2a8) Change-Id: I3501d31e0310481a5872e537bf53ad2faaf25779 Reviewed-on: https://gerrit.libreoffice.org/17895 Reviewed-by: David Tardon <dtar...@redhat.com> Tested-by: David Tardon <dtar...@redhat.com> diff --git a/sw/qa/core/data/ww6/pass/crash-2.doc b/sw/qa/core/data/ww6/pass/crash-2.doc new file mode 100644 index 0000000..f155e97 Binary files /dev/null and b/sw/qa/core/data/ww6/pass/crash-2.doc differ diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 34c5795..cf0f39b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -881,7 +881,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 = pWwFib->GetBaseCp(eType); @@ -900,23 +900,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 (!mpDrawEditEngine) mpDrawEditEngine = new EditEngine(0); mpDrawEditEngine->SetText(rString); - InsertAttrsAsDrawingAttrs(nStartCp, nEndCp, eType); + InsertAttrsAsDrawingAttrs(nStartCp, nStartCp+nLen, eType); // Annotations typically begin with a (useless) 0x5 if ((eType == MAN_AND) && mpDrawEditEngine->GetTextLen()) @@ -966,8 +967,8 @@ SwFrmFmt* 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 (!mpDrawEditEngine) mpDrawEditEngine = new EditEngine(0); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index d9bfe92..179e05f 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1608,7 +1608,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); SwFrmFmt* InsertTxbxText(SdrTextObj* pTextObj, Size* pObjSiz, sal_uInt16 nTxBxS, sal_uInt16 nSequence, long nPosCp, SwFrmFmt* pFlyFmt,
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits