diff options
author | Marc-Andre Laverdiere <marc-andre@atc.tcs.com / marcandre.laverdiere@tcs.com> | 2011-07-20 11:36:38 +0530 |
---|---|---|
committer | Marc-Andre Laverdiere <marc-andre@atc.tcs.com> | 2011-07-29 11:15:19 +0530 |
commit | b2f9a798a010f76e887a7f10c6f0af667fe48e81 (patch) | |
tree | f350d8ea0640a46390bdd92cfeb5ce04eb5b4681 | |
parent | 5d7caec204e704c62d670cc90a39e8cfc78479c6 (diff) |
Fixes for segfault on an edge case + translations
Fixed segfault due to reading an invalid pointer returned by GetStyle
Translated some of the comments
Added some proofing against similar bugs from GetStyle that may happen
in other edge cases
Fixed compile warning
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 3fa6a245f2..a833caa229 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -842,22 +842,20 @@ void SwWW8ImplReader::Read_ANLevelNo( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, short nLen ) // Sprm 12 { + SwWW8StyInf * pStyInf = GetStyle(nAktColl); + if( !pAktColl || nLen <= 0 // only for Styledef + || (pStyInf && !pStyInf->bColl) // ignore CharFmt -> + || ( nIniFlags & WW8FL_NO_OUTLINE ) ) { - SwWW8StyInf * pStyInf = GetStyle(nAktColl); - if( !pAktColl || nLen <= 0 // nur bei Styledef - || (pStyInf && !pStyInf->bColl) // CharFmt -> ignorieren - || ( nIniFlags & WW8FL_NO_OUTLINE ) ){ - nSwNumLevel = 0xff; - return; - } + nSwNumLevel = 0xff; + return; } - if( nSwNumLevel <= MAXLEVEL // Bereich WW:1..9 -> SW:0..8 - && nSwNumLevel <= 9 ){ // keine Aufzaehlung / Nummerierung - // Falls bereits direkt oder durch - // Vererbung NumruleItems gesetzt sind, - // dann jetzt ausschalten + if( nSwNumLevel <= MAXLEVEL // Value range mapping WW:1..9 -> SW:0..8 + && nSwNumLevel <= 9 ){ // No Bullets or Numbering + + // If NumRuleItems were set, either directly or through inheritance, disable them now pAktColl->SetFmtAttr( SwNumRuleItem() ); String aName(CREATE_CONST_ASC( "Outline" )); @@ -868,15 +866,14 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, shor SetAnld(&aNR, (WW8_ANLD*)pData, nSwNumLevel, true); - // fehlende Level muessen nicht aufgefuellt werden - + // Missing Levels need not be replenished rDoc.SetOutlineNumRule( aNR ); }else if( pStyles->nWwNumLevel == 10 || pStyles->nWwNumLevel == 11 ){ SwNumRule* pNR = GetStyRule(); SetAnld(pNR, (WW8_ANLD*)pData, 0, false); pAktColl->SetFmtAttr( SwNumRuleItem( pNR->GetName() ) ); - SwWW8StyInf * pStyInf = GetStyle(nAktColl); + pStyInf = GetStyle(nAktColl); if (pStyInf != NULL) pStyInf->bHasStyNumRule = true; } @@ -994,7 +991,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) } SwWW8StyInf * pStyInf = GetStyle(nAktColl); - if (!sNumRule.Len() && pStyInf->bHasStyNumRule) + if (!sNumRule.Len() && pStyInf != NULL && pStyInf->bHasStyNumRule) { sNumRule = pStyInf->pFmt->GetNumRule().GetValue(); pNumRule = rDoc.FindNumRulePtr(sNumRule); @@ -3831,6 +3828,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty { SwFmt* pColl; bool bStyExist; + if (rSI.bColl) { // Para-Style |