diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-16 14:19:16 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-17 10:09:51 +0100 |
commit | 6e686439291b4047a8c522ebf78d25632d349f62 (patch) | |
tree | 823d2a039e9ac4c0f54e0acc11160659b195f993 /sw | |
parent | b843db1a8e3f50bc88e4278cd330bba86a62a206 (diff) |
Resolves: tdf#113871 bounds check kashida pos
the inner loop checks the kashida validity so reuse the
same check outside to avoid index 3 into vector of len 3
Change-Id: I27c30aec1a61ccc8ca6611498d3281eddb4b54eb
Reviewed-on: https://gerrit.libreoffice.org/44831
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hosken@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/porlay.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 2d23d2aa9710..f075d2efb93d 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1731,11 +1731,10 @@ sal_Int32 SwScriptInfo::KashidaJustify( long* pKernArray, if ( nCntKash < CountKashida() ) { // skip any invalid kashidas - while ( ! IsKashidaValid ( nCntKash ) && nCntKash < nCntKashEnd ) + while (nCntKash < nCntKashEnd && !IsKashidaValid(nCntKash)) ++nCntKash; - sal_Int32 nKashidaPos = GetKashida( nCntKash ); - sal_Int32 nIdx = nKashidaPos; + sal_Int32 nIdx = nCntKash < nCntKashEnd && IsKashidaValid(nCntKash) ? GetKashida(nCntKash) : nEnd; long nKashAdd = nSpaceAdd; while ( nIdx < nEnd ) @@ -1744,10 +1743,10 @@ sal_Int32 SwScriptInfo::KashidaJustify( long* pKernArray, // next kashida position ++nCntKash; - while ( ! IsKashidaValid ( nCntKash ) && nCntKash < nCntKashEnd ) + while (nCntKash < nCntKashEnd && !IsKashidaValid(nCntKash)) ++nCntKash; - nIdx = nCntKash < CountKashida() && IsKashidaValid ( nCntKash ) ? GetKashida( nCntKash ) : nEnd; + nIdx = nCntKash < nCntKashEnd && IsKashidaValid(nCntKash) ? GetKashida(nCntKash) : nEnd; if ( nIdx > nEnd ) nIdx = nEnd; |