[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Aug 9 03:16:24 PDT 2011
sw/source/filter/ww8/ww8par2.cxx | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
New commits:
commit 3442f6fab00e9a9e211324e0c3818bc634585be5
Author: Marc-Andre Laverdiere <marc-andre at atc.tcs.com / marcandre.laverdiere at tcs.com>
Date: Wed Jul 20 11:36:38 2011 +0530
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)
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0e0b46d..78265ce 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
More information about the Libreoffice-commits
mailing list