summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-01-30 19:07:43 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-01-30 19:21:34 +0100
commitb5a73d4b2b283d3d1a57ac0f66b608998960a873 (patch)
tree161451b6d6839d6b0bee87691da52d2fa7c7ef62 /sw
parent6c779863bbd25499f4c7dff7d201403ebef898be (diff)
query remaining stream size after seeking, not before (fdo#45255)
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a97f383e2920..593624b5091c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1978,10 +1978,11 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos,
const sal_uInt32 nValidMin=4;
sal_Size nOldPos = pSt->Tell();
- sal_Size nRemainingSize = pSt->remainingSize();
- bool bValid = checkSeek(*pSt, nFilePos) && (nRemainingSize >= nValidMin) &&
- (nPLCF >= nValidMin);
+ bool bValid = checkSeek(*pSt, nFilePos);
+ sal_Size nRemainingSize = pSt->remainingSize();
+ if( !(nRemainingSize >= nValidMin && nPLCF >= nValidMin ))
+ bValid = false;
nPLCF = bValid ? std::min(nRemainingSize, static_cast<sal_Size>(nPLCF)) : nValidMin;
// Pointer auf Pos- u. Struct-Array
@@ -2136,9 +2137,7 @@ WW8PLCF::WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
{
sal_Size nOldPos = rSt.Tell();
- sal_Size nRemainingSize = rSt.remainingSize();
-
- bool bValid = checkSeek(rSt, nFilePos) && (nRemainingSize >= nPLCF);
+ bool bValid = checkSeek(rSt, nFilePos) && (rSt.remainingSize() >= nPLCF);
if (bValid)
{
@@ -2317,10 +2316,11 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
const sal_uInt32 nValidMin=4;
sal_Size nOldPos = pSt->Tell();
- sal_Size nRemainingSize = pSt->remainingSize();
- bool bValid = checkSeek(*pSt, nFilePos) && (nRemainingSize >= nValidMin) &&
- (nPLCF >= nValidMin);
+ bool bValid = checkSeek(*pSt, nFilePos);
+ sal_Size nRemainingSize = pSt->remainingSize();
+ if( !(nRemainingSize >= nValidMin && nPLCF >= nValidMin ))
+ bValid = false;
nPLCF = bValid ? std::min(nRemainingSize, static_cast<sal_Size>(nPLCF)) : nValidMin;
pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ]; // Pointer auf Pos-Array