Version: (using Devel) Compiler: gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7) OS: Linux Installed from: Compiled sources If you save this HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Test case</title> <script type="text/javascript"> document.cookie = "This is a cookie"; </script> </head> <body> </body> </html> locally and open the page (which tries to store a cookie), kded4 will crash (backtrace below). Note that this issue has been found before in these bug reports (which were about other issues): http://bugs.kde.org/show_bug.cgi?id=169851#c6 http://bugs.kde.org/show_bug.cgi?id=131982#c10 Application: KDE Daemon (kded4), signal SIGABRT Thread 1 (Thread 0xb5eab720 (LWP 6640)): [KCrash Handler] #6 0xb7efb410 in __kernel_vsyscall () #7 0xb641e085 in raise () from /lib/tls/i686/cmov/libc.so.6 #8 0xb641fa01 in abort () from /lib/tls/i686/cmov/libc.so.6 #9 0xb74833d4 in qt_message_output (msgType=QtFatalMsg, buf=0xbfbf82b0 "ASSERT failure in QList<T>::operator[]: \"index out of range\", file /home/kde-devel/qt-copy/include/QtCore/qlist.h, line 401") at global/qglobal.cpp:2061 #10 0xb7483459 in qFatal (msg=0xb76013a8 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qglobal.cpp:2263 #11 0xb74834b0 in qt_assert_x (where=0xb456445d "QList<T>::operator[]", what=0xb456443b "index out of range", file=0xb45643ac "/home/kde-devel/qt-copy/include/QtCore/qlist.h", line=401) at global/qglobal.cpp:1839 #12 0xb45585d6 in QList<QString>::operator[] (this=0xbfbfa320, i=0) at /home/kde-devel/qt-copy/include/QtCore/qlist.h:401 #13 0xb4550186 in KCookieJar::stripDomain (this=0x80631c8, _fqdn=@0xbfbfa348, _domain=@0xbfbfa398) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp:520 #14 0xb4550645 in KCookieJar::stripDomain (this=0x80631c8, cookie=@0x8152e50) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp:527 #15 0xb4550949 in KCookieJar::addCookie (this=0x80631c8, cookie=@0x8152e50) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp:935 #16 0xb4559f1f in KCookieServer::checkCookies (this=0x817acf8, cookieList=0xbfbfa524) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp:181 #17 0xb455a596 in KCookieServer::addCookies (this=0x817acf8, url=@0x8157618, cookieHeader=@0x810dd80, windowId=102760449, useDOMFormat=false) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp:151 #18 0xb455a691 in KCookieServer::addCookies (this=0x817acf8, arg1=@0x8157618, arg2=@0x810dd80, arg3=102760449) at /home/kde-devel/kde/src/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp:418 #19 0xb4563b7b in KCookieServerAdaptor::addCookies (this=0x8117ba8, url=@0x8157618, cookieHeader=@0x810dd80, windowId=102760449) at /home/kde-devel/kde/build/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserveradaptor.cpp:39 #20 0xb4563c29 in KCookieServerAdaptor::qt_metacall (this=0x8117ba8, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfbfa6ec) at /home/kde-devel/kde/build/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserveradaptor.moc:147 #21 0xb76d9fc1 in QDBusConnectionPrivate::deliverCall (this=0x805d188, object=0x8117ba8, msg=@0x815fa00, metaTypes=@0xbfbfa788, slotIdx=4) at qdbusintegrator.cpp:865 #22 0xb76dadff in QDBusConnectionPrivate::activateCall (this=0x805d188, object=0x8117ba8, flags=337, msg=@0x815fa00) at qdbusintegrator.cpp:770 #23 0xb76dbc25 in QDBusConnectionPrivate::activateObject (this=0x805d188, node=@0x815f9ec, msg=@0x815fa00, pathStartPos=19) at qdbusintegrator.cpp:1299 #24 0xb76dbead in QDBusActivateObjectEvent::placeMetaCall (this=0x815f9c0) at qdbusintegrator.cpp:1412 #25 0xb75b3296 in QObject::event (this=0x817acf8, e=0x815f9c0) at kernel/qobject.cpp:1140 #26 0xb67ba3a5 in QApplicationPrivate::notify_helper (this=0x8063918, receiver=0x817acf8, e=0x815f9c0) at kernel/qapplication.cpp:3800 #27 0xb67ba68b in QApplication::notify (this=0xbfbfb058, receiver=0x817acf8, e=0x815f9c0) at kernel/qapplication.cpp:3392 #28 0xb7b0819f in KApplication::notify (this=0xbfbfb058, receiver=0x817acf8, event=0x815f9c0) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311 #29 0xb759d735 in QCoreApplication::notifyInternal (this=0xbfbfb058, receiver=0x817acf8, event=0x815f9c0) at kernel/qcoreapplication.cpp:591 #30 0xb75a1d05 in QCoreApplication::sendEvent (receiver=0x817acf8, event=0x815f9c0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215 #31 0xb759dcd6 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x804b6b0) at kernel/qcoreapplication.cpp:1202 #32 0xb759df4b in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1095 #33 0xb75d48ca in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:220 #34 0xb75d3ab7 in postEventSourceDispatch (s=0x8065ad8) at kernel/qeventdispatcher_glib.cpp:211 #35 0xb6151dd6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #36 0xb6155193 in ?? () from /usr/lib/libglib-2.0.so.0 #37 0xb615574e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #38 0xb75d2d18 in QEventDispatcherGlib::processEvents (this=0x80620d0, flags=@0xbfbfaf24) at kernel/qeventdispatcher_glib.cpp:325 #39 0xb6876a00 in QGuiEventDispatcherGlib::processEvents (this=0x80620d0, flags=@0xbfbfaf54) at kernel/qguieventdispatcher_glib.cpp:204 #40 0xb7599fb2 in QEventLoop::processEvents (this=0xbfbfafdc, flags=@0xbfbfaf94) at kernel/qeventloop.cpp:149 #41 0xb759a1f1 in QEventLoop::exec (this=0xbfbfafdc, flags=@0xbfbfafe4) at kernel/qeventloop.cpp:200 #42 0xb759e06c in QCoreApplication::exec () at kernel/qcoreapplication.cpp:849 #43 0xb67ba0be in QApplication::exec () at kernel/qapplication.cpp:3330 #44 0xb7ef16f4 in kdemain (argc=1, argv=0xbfbfb254) at /home/kde-devel/kde/src/KDE/kdelibs/kded/kded.cpp:896 #45 0x08048696 in main (argc=) at /home/kde-devel/kde/build/KDE/kdelibs/kded/kded4_dummy.cpp:3
I forgot to say that I got the crash in 4.1 and SVN trunk rev. 855403.
The obvious fix is a patch like this (in kdelibs/kioslave/http/kcookiejar): Index: kcookiejar.cpp =================================================================== --- kcookiejar.cpp (revision 854524) +++ kcookiejar.cpp (working copy) @@ -516,7 +516,7 @@ extractDomains(_fqdn, domains); if (domains.count() > 3) _domain = domains[3]; - else + else if (!domains.isEmpty()) _domain = domains[0]; } to check if the domains list is empty. That relies on the rest of KCookieJar being able to cope with that. Judging from the code I was reading and the test I did it seems KCookieJar can cope with that. That still leaves the question of why is it this only happens if the page is saved locally though. I do know that a local CGI script does not cause this crash using the set-cookie: http header. I haven't tried reproducing the testcase html on a remote server however.
Created attachment 27177 [details] Test case (to verify that you get no crash when loading the file from a remote server) Michael, thanks for the quick reply and the patch. After applying it, I got no more kded4 crashes, and the cookie was set correctly. Maybe I should have been a bit more precise in my report: It's not only important to store the file locally, but also to access it via a "file:/" URL. Putting it on a local webserver and accessing it via "http://localhost/..." does not crash kded4. Loading it from a remote web server doesn't crash either (I've attached the test case for easy verification).
Fixed by r856375/856379.
*** Bug 170898 has been marked as a duplicate of this bug. ***