diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-29 15:25:47 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-29 15:26:14 +0000 |
commit | f0cc59c02e5d4e275f11c586239e7eb0012a9609 (patch) | |
tree | c92f2213c88de06413722cd5a0ef2bdf4a3ae8bc /sw | |
parent | a6750166cdd9b39f4e948201143c70ea95def600 (diff) |
undo semi-revert
Change-Id: Ifc332d34d23cdc1bb5be80f7cfe440bdc6a12d23
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 6d6137e151d1..e2a2a87f9daa 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1205,10 +1205,17 @@ WW8_FC WW8PLCFx_PCD::AktPieceStartCp2Fc( WW8_CP nCp ) if( !bVer67 ) nFC = WW8PLCFx_PCD::TransformPieceAddress( nFC, bIsUnicode ); - WW8_CP nDistance = nCp - nCpStart; + WW8_CP nDistance; + bool bFail = o3tl::checked_sub(nCp, nCpStart, nDistance); + if (bFail) + { + SAL_WARN("sw.ww8", "broken offset, ignoring"); + return WW8_FC_MAX; + } + if (bIsUnicode) { - const bool bFail = o3tl::checked_multiply<WW8_CP>(nDistance, 2, nDistance); + bFail = o3tl::checked_multiply<WW8_CP>(nDistance, 2, nDistance); if (bFail) { SAL_WARN("sw.ww8", "broken offset, ignoring"); @@ -1217,7 +1224,7 @@ WW8_FC WW8PLCFx_PCD::AktPieceStartCp2Fc( WW8_CP nCp ) } WW8_FC nRet; - const bool bFail = o3tl::checked_add(nFC, nDistance, nRet); + bFail = o3tl::checked_add(nFC, nDistance, nRet); if (bFail) { SAL_WARN("sw.ww8", "broken offset, ignoring"); |