Bug 173870

Summary: Konqueror crash at Google Translator
Product: [Applications] konqueror Reporter: usrrgt
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: grave CC: andreas_nordal_4, jlp, jseward, mail, null, rasasi78, ropesogm, sts, vmikiv, workingwriter
Priority: NOR    
Version: 4.1.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description usrrgt 2008-10-29 23:26:14 UTC
Version:           4.1.2 (using KDE 4.1.2)
OS:                Linux
Installed from:    Ubuntu Packages

1.) Go to www.google.com
2.) Write "Google Translate" in the text box.
3.) Click on Google Translate link.
4.) Click on the "Back" button of Konqueror.
5.) Konqueror crashes.

Backtrace:

Aplicación: Konqueror (konqueror), señal SIGSEGV
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb608e8d0 (LWP 6914)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#6  0xb73fb2ab in QString::operator== () from /usr/lib/libQtCore.so.4
#7  0xb4166980 in KHTMLPart::restoreState () from /usr/lib/libkhtml.so.5
#8  0xb4192a7e in ?? () from /usr/lib/libkhtml.so.5
#9  0xb7fb0216 in ?? () from /usr/lib/libkdeinit4_konqueror.so
#10 0xb8007240 in ?? () from /usr/lib/libkdeinit4_konqueror.so
#11 0xb8011c97 in ?? () from /usr/lib/libkdeinit4_konqueror.so
#12 0xb74bea60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#13 0xb74bf7e2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#14 0xb74c4db7 in ?? () from /usr/lib/libQtCore.so.4
#15 0xb74c4edc in ?? () from /usr/lib/libQtCore.so.4
#16 0xb74b953f in QObject::event () from /usr/lib/libQtCore.so.4
#17 0xb69ad8ec in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#18 0xb69b576e in QApplication::notify () from /usr/lib/libQtGui.so.4
#19 0xb797972d in KApplication::notify () from /usr/lib/libkdeui.so.5
#20 0xb74a9e61 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#21 0xb74d7d81 in ?? () from /usr/lib/libQtCore.so.4
#22 0xb74d4520 in ?? () from /usr/lib/libQtCore.so.4
#23 0xb64206f8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#24 0xb6423da3 in ?? () from /usr/lib/libglib-2.0.so.0
#25 0xb6423f61 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#26 0xb74d4478 in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#27 0xb6a47ee5 in ?? () from /usr/lib/libQtGui.so.4
#28 0xb74a852a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#29 0xb74a86ea in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#30 0xb74aada5 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#31 0xb69ad767 in QApplication::exec () from /usr/lib/libQtGui.so.4
#32 0xb803d95d in kdemain () from /usr/lib/libkdeinit4_konqueror.so
#33 0x080485b2 in _start ()
#0  0xb8083430 in __kernel_vsyscall ()
Comment 1 Julian Seward 2008-10-30 01:05:26 UTC
I can repro this this svn rev 876722.  From quick prodding with Valgrind,
I suspect this is could be an uninitialised value error, which leads later
to an invalid memory access.

A tiny fraction of a second after I click the back button, as in the
repro instructions, I get the following two errors from V.  I think
the second is likely to be caused by the first, viz, the first is a
possible root cause.

Conditional jump or move depends on uninitialised value(s)
   at 0x4E6F3DD: KonqView::restoreHistory() (konqview.cpp:859)
   by 0x4E6F773: KonqView::go(int) (konqview.cpp:835)
   by 0x4EAC1BD: KonqMainWindow::slotGoHistoryDelayed() (konqmainwindow.cpp:2819)
   by 0x4EB12F4: KonqMainWindow::qt_metacall(QMetaObject::Call, int, void**) (konqmainwindow.moc:437)
   by 0x679F3E2: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3022)
   by 0x67A069C: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3092)
   by 0x67A53DD: QSingleShotTimer::timeout() (qtimer.moc:74)
   by 0x67A549A: QSingleShotTimer::timerEvent(QTimerEvent*) (qtimer.cpp:294)
   by 0x679AA07: QObject::event(QEvent*) (qobject.cpp:1111)
   by 0x75E0C52: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:3803)
   by 0x75E80DB: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3393)
   by 0x5BD8803: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:307)
 Uninitialised value was created by a heap allocation
   at 0x4C2530C: operator new(unsigned long) (vg_replace_malloc.c:230)
   by 0x4E6D838: KonqView::createHistoryEntry() (konqview.cpp:737)
   by 0x4E6FD88: KonqView::openUrl(KUrl const&, QString const&, QString const&, bool) (konqview.cpp:195)
   by 0x4EAB60D: KonqMainWindow::openView(QString, KUrl const&, KonqView*, KonqOpenURLRequest const&) (konqmainwindow.cpp:932)
   by 0x4E69B27: KonqRun::tryOpenView(QString const&, bool) (konqrun.cpp:158)
   by 0x4E69CAB: KonqRun::foundMimeType(QString const&) (konqrun.cpp:93)
   by 0x56991BB: KRun::mimeTypeDetermined(QString const&) (krun.cpp:1125)
   by 0x7F3C15B: KParts::BrowserRun::slotBrowserMimetype(KIO::Job*, QString const&) (browserrun.cpp:222)
   by 0x7F3C3BE: KParts::BrowserRun::qt_metacall(QMetaObject::Call, int, void**) (browserrun.moc:73)
   by 0x4E69735: KonqRun::qt_metacall(QMetaObject::Call, int, void**) (konqrun.moc:62)
   by 0x679F3E2: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3022)
   by 0x67A069C: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3092)

Invalid read of size 4
   at 0x66F74D8: QString::operator==(QString const&) const (qstring.cpp:1768)
   by 0x15280666: QString::operator!=(QString const&) const (qstring.h:372)
   by 0x15276244: KHTMLPart::restoreState(QDataStream&) (khtml_part.cpp:5677)
   by 0x15290A36: KHTMLPartBrowserExtension::restoreState(QDataStream&) (khtml_ext.cpp:104)
   by 0x4E6F41C: KonqView::restoreHistory() (konqview.cpp:864)
   by 0x4E6F773: KonqView::go(int) (konqview.cpp:835)
   by 0x4EAC1BD: KonqMainWindow::slotGoHistoryDelayed() (konqmainwindow.cpp:2819)
   by 0x4EB12F4: KonqMainWindow::qt_metacall(QMetaObject::Call, int, void**) (konqmainwindow.moc:437)
   by 0x679F3E2: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3022)
   by 0x67A069C: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3092)
   by 0x67A53DD: QSingleShotTimer::timeout() (qtimer.moc:74)
   by 0x67A549A: QSingleShotTimer::timerEvent(QTimerEvent*) (qtimer.cpp:294)
 Address 0x8 is not stack'd, malloc'd or (recently) free'd
Comment 2 Julian Seward 2008-10-30 02:10:12 UTC
Just to record another finding:

changing konqview.cpp:737 as follows stops it crashing, and also gets rid of the uninit var warning

{ HistoryEntry* hh = new HistoryEntry; hh->reload = true; appendHistoryEntry(hh); }

(previously line 737 was: appendHistoryEntry( new HistoryEntry ); )

I am sure this is merely treating the symptoms, and not a proper fix.
Comment 3 Sebastian Sauer 2008-11-04 03:28:26 UTC
The actual problem seems to be, that fNameIt goes frameNames.constEnd() and we deref it without checking for it. Following patch shows the prob (it asserts for me at the theird assert);

Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp      (revision 879699)
+++ khtml_part.cpp      (working copy)
@@ -5667,12 +5667,15 @@
     KUrl::List::ConstIterator fURLIt = frameURLs.constBegin();
     QList<QByteArray>::ConstIterator fBufferIt = frameStateBuffers.constBegin();
     QList<int>::ConstIterator fFrameTypeIt = frameTypes.constBegin();
-
+Q_ASSERT(fNameIt != frameNames.constEnd());
+Q_ASSERT(fServiceTypeIt != frameServiceTypes.constEnd());
     for (; fIt != fEnd; ++fIt, ++fNameIt, ++fServiceTypeIt, ++fServiceNameIt, ++fURLIt, ++fBufferIt, ++fFrameTypeIt )
     {
       khtml::ChildFrame* const child = *fIt;

 //      kDebug( 6050 ) <<  *fNameIt  << " ---- " <<  *fServiceTypeIt;
+Q_ASSERT(fNameIt != frameNames.constEnd());
+Q_ASSERT(fServiceTypeIt != frameServiceTypes.constEnd());

       if ( child->m_name != *fNameIt || child->m_serviceType != *fServiceTypeIt )
       {

The question is, why this happens and how to fix it. The "if ( !(*it)->m_part ) continue;" in KHTMLPart::saveState is not the reason :-/
Comment 4 Sebastian Sauer 2008-11-04 03:37:32 UTC
Interesting case; once on the "Google Translate" page, 2 histroy-items got added (in trunk as well as in 3.5). Those that triggers the crash is actually the same page while those one before is the one someone would expect to go to by clicking back. Going direct back to those second one does not trigger a crash, only going back to the same page does.
Comment 5 Rosalvo 2009-03-23 22:58:29 UTC
When I put a word or phrase in portuguese
on the box's translating, it is not translated. Nothing happen when I clik on the button "translate".
Comment 6 Tommi Tervo 2009-03-24 07:09:17 UTC
re: comment #5: see: https://bugs.kde.org/show_bug.cgi?id=184166
Comment 7 Maksim Orlovich 2009-05-24 17:47:13 UTC
*** Bug 186993 has been marked as a duplicate of this bug. ***
Comment 8 Maksim Orlovich 2009-05-24 17:47:41 UTC
*** Bug 191709 has been marked as a duplicate of this bug. ***
Comment 9 Maksim Orlovich 2009-05-24 17:49:13 UTC
*** Bug 193396 has been marked as a duplicate of this bug. ***
Comment 10 Maksim Orlovich 2009-05-24 17:51:21 UTC
*** Bug 193915 has been marked as a duplicate of this bug. ***
Comment 11 Maksim Orlovich 2009-05-24 18:01:43 UTC
*** Bug 193054 has been marked as a duplicate of this bug. ***
Comment 12 Maksim Orlovich 2009-05-24 18:02:46 UTC
193054 has a (non-reduced) testcase.
Comment 13 Raúl 2009-06-25 18:27:30 UTC
May this be a dupe of https://bugs.kde.org/show_bug.cgi?id=158794 ?
Comment 14 Maksim Orlovich 2009-07-17 20:29:32 UTC
SVN commit 998473 by orlovich:

Do full restore on going back when frame count doesn't match. Should fix the restoreState/QString::operator==
crash. I am not at all happy with full restore path, but its flaws should be considerably less, uhm, crashy.
CCBUG: 170185
BUG: 158794
BUG: 173870
BUG: 183733
BUG: 193828
BUG: 196724
BUG: 196795
BUG: 197435
BUG: 198646
BUG: 199806
BUG: 200425
(Not dup'ing those to avoid sending a whole bunch of people 10 e-mails. Plus, it's more fun this way!)


 M  +1 -1      khtml_part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=998473
Comment 15 Maksim Orlovich 2009-07-18 00:24:58 UTC
SVN commit 998543 by orlovich:

Merged revision:r998473 | orlovich | 2009-07-17 14:29:18 -0400 (Fri, 17 Jul 2009) | 15 lines

Do full restore on going back when frame count doesn't match. Should fix the restoreState/QString::operator==
crash. I am not at all happy with full restore path, but its flaws should be considerably less, uhm, crashy.
CCBUG: 170185
BUG: 158794
BUG: 173870
BUG: 183733
BUG: 193828
BUG: 196724
BUG: 196795
BUG: 197435
BUG: 198646
BUG: 199806
BUG: 200425
(Not dup'ing those to avoid sending a whole bunch of people 10 e-mails. Plus, it's more fun this way!)

 M  +1 -1      khtml_part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=998543