[Libreoffice-commits] core.git: sw/source

Luboš Luňák l.lunak at collabora.com
Wed Apr 30 15:37:17 PDT 2014


 sw/source/ui/chrdlg/drpcps.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f1b2261cef7c9996af60f8902e9c0db4bbf896ac
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Thu May 1 00:34:22 2014 +0200

    break infinite loop
    
    endOfScript() can return -1 , which will never be >= maText.getLength(),
    and nothing will update once nChg is that way. It originally worked
    when nChg was unsigned, but 44fbecbfe297cefcc844ca2071fbf017777dd4c3
    changed that and missed it (no wonder, given even the explicit cast,
    which was stupid, so possibly there is a problem elsewhere, but this
    way it at least doesn't lock up).
    
    Change-Id: Ia5138ba36916bd0bfb8f07854580c39d2622f201

diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 2b83a83..5edfda1 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -428,7 +428,7 @@ void SwDropCapsPict::CheckScript( void )
     {
         nChg = xBreak->endOfScript( maText, nChg, nScript );
         maScriptChanges.push_back( _ScriptInfo(0, nScript, nChg) );
-        if( nChg >= maText.getLength() )
+        if( nChg >= maText.getLength() || nChg < 0 )
             break;
         nScript = xBreak->getScriptType( maText, nChg );
     }


More information about the Libreoffice-commits mailing list