summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-Andre Laverdiere <marc-andre@atc.tcs.com / marcandre.laverdiere@tcs.com>2011-07-20 11:36:38 +0530
committerCaolán McNamara <caolanm@redhat.com>2011-08-09 11:16:16 +0100
commit3442f6fab00e9a9e211324e0c3818bc634585be5 (patch)
treec4736aa0db01dc13495e73eb52d766db349da60c
parent2f151aae24ac54b5efd675f4b2f162e07e02ac10 (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 (cherry picked from commit b2f9a798a010f76e887a7f10c6f0af667fe48e81)
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0e0b46df04..78265ce957 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -839,22 +839,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" ));
@@ -865,15 +863,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;
}
@@ -991,7 +988,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);
@@ -3879,6 +3876,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
{
SwFmt* pColl;
bool bStyExist;
+
if (rSI.bColl)
{
// Para-Style