[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: PATCH: kdelibs/kdecore/kstringhandler.cpp, prevent underflow while
From: Alfons Hoogervorst <alfons () proteus ! demon ! nl>
Date: 2004-01-31 0:44:34
Message-ID: 20040131014434.5ceb0af5 () proteus ! demon ! nl
[Download RAW message or body]
Lo,
CVS HEAD, but there may be already a fix in the original developer's
local copy.
Go to:
http://better-scm.berlios.de/comparison/comparison.html#web_interface
Open the "Yes: Vestaweb" link in a new tab.
Result is 100% CPU usage because rightIdx is decremented without
checking its lowerbound (0).
Patch attached adds the lbound check.
Bye.
--
Ecuación algebraico sin solución posible,
a menos de poseer profundos conocimientos
en matemática - Revueltas (Ocho Por Radio)
["kdelibs.kdecore.kstringhandler.cpp.patch" (text/plain)]
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 00:40:31 -0000
@@ -329,10 +329,10 @@
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 && 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 );
}
}
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic