This is a multi-part message in MIME format. --Multipart=_Sat__31_Jan_2004_02_54_52_+0100_QsgF/IPm1CYxwpyP Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Lo Alfons, On 31-01-04 (Sat) 01:44 +0100 Alfons Hoogervorst wrote: | CVS HEAD, but there may be already a fix in the original developer's | local copy. |=20 | Go to: |=20 | http://better-scm.berlios.de/comparison/comparison.html#web_interface |=20 | Open the "Yes: Vestaweb" link in a new tab. |=20 | Result is 100% CPU usage because rightIdx is decremented without | checking its lowerbound (0). |=20 | Patch attached adds the lbound check. Hmng. Not good enough.=20 Here's another underflow fix; plus the same checks in the outer loop condition.=20 Surely the orginal developer comes with something better - looking forward to it. :-) Bye. --=20 Ecuaci=F3n algebraico sin soluci=F3n posible, a menos de poseer profundos conocimientos en matem=E1tica - Revueltas (Ocho Por Radio) --Multipart=_Sat__31_Jan_2004_02_54_52_+0100_QsgF/IPm1CYxwpyP Content-Type: text/plain; name="kdelibs.kdecore.kstringhandler.cpp.patch" Content-Disposition: attachment; filename="kdelibs.kdecore.kstringhandler.cpp.patch" Content-Transfer-Encoding: 7bit Index: kdecore/kstringhandler.cpp =================================================================== RCS file: /home/kde/kdelibs/kdecore/kstringhandler.cpp,v retrieving revision 1.35 diff -u -r1.35 kstringhandler.cpp --- kdecore/kstringhandler.cpp 29 Jan 2004 11:35:14 -0000 1.35 +++ kdecore/kstringhandler.cpp 31 Jan 2004 01:49:31 -0000 @@ -320,7 +320,9 @@ return s; } - const unsigned int maxWidth = width - fm.width( '.' ) * 3; + const unsigned int maxWidth = width > (uint) fm.width( '.') * 3 + ? width - (uint) fm.width( '.' ) * 3 + : width; if ( maxWidth <= 0 ) { return "..."; } @@ -328,11 +330,11 @@ unsigned int leftIdx = 0, rightIdx = length; unsigned int leftWidth = fm.charWidth( s, leftIdx++ ); unsigned int rightWidth = fm.charWidth( s, --rightIdx ); - while ( leftWidth + rightWidth < maxWidth ) { - while ( leftWidth <= rightWidth && leftWidth + rightWidth < maxWidth ) { + while ( leftWidth + rightWidth < maxWidth && leftIdx < length && rightIdx > 0 ) { + while ( leftWidth <= rightWidth && leftWidth + rightWidth < maxWidth && leftIdx < length ) { leftWidth += fm.charWidth( s, leftIdx++ ); } - while ( rightWidth <= leftWidth && leftWidth + rightWidth < maxWidth ) { + while ( rightWidth <= leftWidth && leftWidth + rightWidth < maxWidth && rightIdx > 0 ) { rightWidth += fm.charWidth( s, --rightIdx ); } } --Multipart=_Sat__31_Jan_2004_02_54_52_+0100_QsgF/IPm1CYxwpyP Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Multipart=_Sat__31_Jan_2004_02_54_52_+0100_QsgF/IPm1CYxwpyP--