Bug#440098: kwordquiz: bug located [PATCH]
Package: kwordquiz
Version: 4:3.5.5-1
Followup-For: Bug #440098
Hi again!
This bug is in the kdeedu-3.5.5/kwordquiz/src/qaview.cpp file, in the
highlightError function.
30 QString highlightError(const QString & c, const QString & e)
31 {
32 QString s = c;
33 if (s.left(4) == "<qt>" && e.left(4) != "<qt>")
34 s = s.mid(4, s.length() - 9);
35
36 QString result = "<qt>";
37 int i = 0;
38 while (s[i] == e[i]) // <--------- Here!
39 result.append(e[i++]); // <--------- And here!
40 result.append("<b>");
41 QString result2 = "</qt>";
If strings `s' and `e' are the same, pointer go beyond the limits of string.
Possible patch:
--- kdeedu-3.5.5/kwordquiz/src/qaview.cpp.orig 2006-03-17
15:10:10.000000000 +0500
+++ kdeedu-3.5.5/kwordquiz/src/qaview.cpp 2007-08-30
23:21:46.000000000 +0600
@@ -34,6 +34,10 @@
s = s.mid(4, s.length() - 9);
QString result = "<qt>";
+ if (s == e) {
+ result += s + "</qt>";
+ return result;
+ }
int i = 0;
while (s[i] == e[i])
result.append(e[i++]);
I'm neither QT nor C/C++ coder so patch maybe not good :) but it works ;)
Do with it something.
--
wbr
Denis Sirotkin
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (450, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.21-2-k7 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Shell: /bin/sh linked to /bin/dash
Versions of packages kwordquiz depends on:
ii kdeedu-data 4:3.5.5-1 shared data for KDE educational ap
ii kdelibs4c2a 4:3.5.7.dfsg.1-4 core libraries and binaries for al
ii libc6 2.6.1-1 GNU C Library: Shared libraries
ii libgcc1 1:4.2.1-4 GCC support library
ii libice6 2:1.0.3-3 X11 Inter-Client Exchange library
ii libpng12-0 1.2.15~beta5-2 PNG library - runtime
ii libqt3-mt 3:3.3.7-6 Qt GUI Library (Threaded runtime v
ii libsm6 2:1.0.3-1+b1 X11 Session Management library
ii libstdc++6 4.2.1-4 The GNU Standard C++ Library v3
ii libx11-6 2:1.0.3-7 X11 client-side library
ii libxext6 1:1.0.3-2 X11 miscellaneous extension librar
ii zlib1g 1:1.2.3.3.dfsg-5 compression library - runtime
kwordquiz recommends no packages.
-- no debconf information
Reply to: