[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/source

Lionel Elie Mamane lionel at mamane.lu
Tue Jul 21 07:59:10 PDT 2015


 vcl/source/control/field2.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit f838b4f5495f1e70d005bbb1e991b63409ada5a8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Jul 21 14:02:59 2015 +0200

    avoid 1-past-the-end string access
    
    Change-Id: Ia475ce737c430fab8d019e1b8a762f81897e0847
    Reviewed-on: https://gerrit.libreoffice.org/17260
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 3f343b2..c9253f8 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -432,15 +432,14 @@ static sal_Int32 ImplPatternRightPos( const OUString& rStr, const OString& rEdit
 {
     // search non-literal successor
     sal_Int32 nNewPos = nCursorPos;
-    sal_Int32 nTempPos = nNewPos;
-    while ( nTempPos < rEditMask.getLength() )
+    ;
+    for(sal_Int32 nTempPos = nNewPos+1; nTempPos < rEditMask.getLength(); ++nTempPos )
     {
-        if ( rEditMask[nTempPos+1] != EDITMASK_LITERAL )
+        if ( rEditMask[nTempPos] != EDITMASK_LITERAL )
         {
-            nNewPos = nTempPos+1;
+            nNewPos = nTempPos;
             break;
         }
-        nTempPos++;
     }
     ImplPatternMaxPos( rStr, rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
     return nNewPos;


More information about the Libreoffice-commits mailing list