diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-12 09:14:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-12 09:15:13 +0100 |
commit | 2d33d18c4857d7b845a1c6dae4e5aa391f4a781d (patch) | |
tree | b55e254276046fb2ca64a5815c7226cfc3d9f4db /sw | |
parent | 25d396589e22a047d8e31655a8c2df61182088c1 (diff) |
consider negative nPN a failure
translate and consolidate end before start warnings to SAL_WARN
Change-Id: I547075c0ca668da184f477112086f401cc9ec4ee
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 6d1089ab5d8a..59b133d157b8 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2158,7 +2158,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) bool failure = false; nIMax = ncpN; - if ((nIMax < 1) || (nIMax > (WW8_CP_MAX - 4)/6) || ((nPN + ncpN) > USHRT_MAX)) + if ((nIMax < 1) || (nIMax > (WW8_CP_MAX - 4)/6) || ((nPN + ncpN) > USHRT_MAX) || nPN < 0) failure = true; if (!failure) @@ -2172,7 +2172,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) failure = true; // construct FC entries // first FC entry of each Fkp - if (checkSeek(rSt, static_cast<sal_uInt32>( nPN + i ) << 9 )) + if (checkSeek(rSt, ( nPN + i ) << 9 )) continue; WW8_CP nFc(0); rSt.ReadInt32( nFc ); @@ -2220,7 +2220,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) } } - OSL_ENSURE( !failure, "Document has corrupt PLCF, ignoring it" ); + SAL_WARN_IF(failure, "sw.ww8", "Document has corrupt PLCF, ignoring it"); if (failure) MakeFailedPLCF(); @@ -4400,8 +4400,8 @@ void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc ) void WW8PLCFxDesc::ReduceByOffset() { - OSL_ENSURE((WW8_CP_MAX == nStartPos) || (nStartPos <= nEndPos), - "Attr-Anfang und -Ende ueber Kreuz" ); + SAL_WARN_IF(WW8_CP_MAX != nStartPos && nStartPos > nEndPos, "sw.ww8", + "End " << nEndPos << " before Start " << nStartPos); if( nStartPos != WW8_CP_MAX ) { @@ -4439,8 +4439,8 @@ void WW8PLCFMan::GetNewNoSprms( WW8PLCFxDesc& rDesc ) rDesc.nCp2OrIdx = rDesc.pPLCFx->GetNoSprms(rDesc.nStartPos, rDesc.nEndPos, rDesc.nSprmsLen); - OSL_ENSURE((WW8_CP_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), - "Attr-Anfang und -Ende ueber Kreuz" ); + SAL_WARN_IF(WW8_CP_MAX != rDesc.nStartPos && rDesc.nStartPos > rDesc.nEndPos, "sw.ww8", + "End " << rDesc.nEndPos << " before Start " << rDesc.nStartPos); rDesc.ReduceByOffset(); @@ -4950,7 +4950,8 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart) p->nSprmsLen = 0; GetNewSprms( *p ); } - OSL_ENSURE( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); + SAL_WARN_IF(p->nStartPos > p->nEndPos, "sw.ww8", + "End " << p->nEndPos << " before Start " << p->nStartPos); } } } |