diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-12 08:50:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-12 09:15:13 +0100 |
commit | 25d396589e22a047d8e31655a8c2df61182088c1 (patch) | |
tree | ef085ba51c9e4cae00fb80b64d025481b7d94aef /sw | |
parent | 6f3d58c6bf31e0575abfdcfc3a27d1af8456907d (diff) |
test for end before start, e.g. hang-3.doc
Change-Id: I3b0c7766cdba31d6303de7fe34a5c85567de8116
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 8ad6e09aa70c..6d1089ab5d8a 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6670,6 +6670,11 @@ bool WW8PLCF_HdFt::GetTextPos(sal_uInt8 grpfIhdt, sal_uInt8 nWhich, WW8_CP& rSta aPLCF.SetIdx( nIdx ); // Lookup suitable CP aPLCF.Get( rStart, nEnd, pData ); + if (nEnd < rStart) + { + SAL_WARN("sw.ww8", "End " << nEnd << " before Start " << rStart); + return false; + } rLen = nEnd - rStart; aPLCF.advance(); @@ -6683,7 +6688,13 @@ bool WW8PLCF_HdFt::GetTextPosExact(short nIdx, WW8_CP& rStart, WW8_CP& rLen) aPLCF.SetIdx( nIdx ); // Lookup suitable CP aPLCF.Get( rStart, nEnd, pData ); - rLen = static_cast<sal_uInt32>(nEnd) - static_cast<sal_uInt32>(rStart); + if (nEnd < rStart) + { + SAL_WARN("sw.ww8", "End " << nEnd << " before Start " << rStart); + return false; + } + rLen = nEnd - rStart; + return true; } |