[Libreoffice-commits] .: 2 commits - sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Dec 15 05:25:30 PST 2010
sw/source/filter/ww8/ww8par.cxx | 2 -
sw/source/filter/ww8/ww8scan.cxx | 44 ++++++++++++++++++++++++++++++---------
2 files changed, 35 insertions(+), 11 deletions(-)
New commits:
commit 5a507a965ba8ad17386aacc8775d2804fdba049e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 15 13:17:28 2010 +0000
Handle 0 length entries gracefully
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 44f1f69..b1e0351 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2561,6 +2561,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
long nOldPos = pSt->Tell();
pSt->Seek(nFilePos);
+ memset(maRawData, 0, 512);
pSt->Read(maRawData, 512);
mnIMax = maRawData[511];
@@ -2605,24 +2606,36 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
aEntry.mnLen = maRawData[nOfs+1];
nDelta++;
}
-
aEntry.mnLen *= 2;
//stylecode, std/istd
if (eVersion == ww::eWW2)
{
- aEntry.mnIStd = *(maRawData+nOfs+1+nDelta);
- aEntry.mnLen--; //style code
- aEntry.mnLen-=6; //PHE
- //skipi stc, len byte + 6 byte PHE
- aEntry.mpData = maRawData + nOfs + 8;
+ if (aEntry.mnLen >= 1)
+ {
+ aEntry.mnIStd = *(maRawData+nOfs+1+nDelta);
+ aEntry.mnLen--; //style code
+ if (aEntry.mnLen >= 6)
+ {
+ aEntry.mnLen-=6; //PHE
+ //skipi stc, len byte + 6 byte PHE
+ aEntry.mpData = maRawData + nOfs + 8;
+ }
+ else
+ aEntry.mnLen=0; //Too short
+ }
}
else
{
- aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta);
- aEntry.mnLen-=2; //istd
- //skip istd, len byte + optional extra len byte
- aEntry.mpData = maRawData + nOfs + 3 + nDelta;
+ if (aEntry.mnLen >= 2)
+ {
+ aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta);
+ aEntry.mnLen-=2; //istd
+ //skip istd, len byte + optional extra len byte
+ aEntry.mpData = maRawData + nOfs + 3 + nDelta;
+ }
+ else
+ aEntry.mnLen=0; //Too short, ignore
}
USHORT nSpId = aEntry.mnLen ? maSprmParser.GetSprmId(aEntry.mpData) : 0;
@@ -2666,6 +2679,17 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
}
maEntries.push_back(aEntry);
+
+#ifdef DEBUGSPRMREADER
+ {
+ sal_Int32 nLen;
+ BYTE* pSprms = GetLenAndIStdAndSprms( nLen );
+
+ WW8SprmIter aIter(pSprms, nLen, maSprmParser);
+ while(aIter.GetSprms())
+ aIter.advance();
+ }
+#endif
}
//one more FC than grrpl entries
commit be99cfc3054cc2b60c9f45497391708cbb68adb8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 15 11:41:14 2010 +0000
only read SttbfAssoc if its length is > 0
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 801cc2f..0df3331 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3895,7 +3895,7 @@ void SwWW8ImplReader::ReadDocInfo()
xDocProps->setTemplateURL( sTemplateURL );
}
}
- else // not a template
+ else if (pWwFib->lcbSttbfAssoc) // not a template, and has a SttbfAssoc
{
long nCur = pTableStream->Tell();
Sttb aSttb;
More information about the Libreoffice-commits
mailing list